nixos-config/flake.nix

120 lines
3.3 KiB
Nix
Raw Normal View History

2023-03-29 13:14:37 +00:00
{
inputs = {
# Pin nixpkgs to a specific commit
2023-09-28 10:58:29 +00:00
# nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.url = "path:/home/xin/nixpkgs";
2023-05-27 01:39:16 +00:00
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05";
2023-03-29 13:14:37 +00:00
2023-04-16 02:30:45 +00:00
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-09-11 12:20:32 +00:00
nur = {
url = "github:nix-community/NUR";
};
2023-03-29 13:14:37 +00:00
2023-09-11 12:20:32 +00:00
nixos-hardware = {
url = "github:NixOS/nixos-hardware/master";
};
2023-04-16 05:18:23 +00:00
2023-04-03 09:41:33 +00:00
nixos-cn = {
url = "github:nixos-cn/flakes";
# Use the same nixpkgs
2023-04-16 02:30:45 +00:00
inputs.nixpkgs.follows = "nixpkgs";
2023-04-03 09:41:33 +00:00
};
2023-04-16 02:30:45 +00:00
2023-09-11 12:20:32 +00:00
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
conduit.url = "gitlab:famedly/conduit/v0.6.0";
conduit.inputs.nixpkgs.follows = "nixpkgs";
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
2023-09-11 12:20:32 +00:00
flake-utils = {
url = "github:numtide/flake-utils";
};
2023-04-03 09:41:33 +00:00
};
2023-04-16 05:18:23 +00:00
outputs = { self, ... }@inputs:
with inputs;
2023-04-16 02:30:45 +00:00
let
mkHome = user: host: { config, system, ... }: {
imports = [
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.xin = import ./home/${user}/${host};
home-manager.extraSpecialArgs = { inherit inputs system; };
}
];
};
mkNixos = { system, modules, specialArgs ? {}}: nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = specialArgs // { inherit inputs system; };
modules = [
home-manager.nixosModules.home-manager
nur.nixosModules.nur
sops-nix.nixosModules.sops
] ++ modules;
2023-04-16 02:30:45 +00:00
};
in
{
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
nixosConfigurations.calcite = mkNixos {
2023-04-16 02:30:45 +00:00
system = "x86_64-linux";
modules = [
nixos-hardware.nixosModules.asus-zephyrus-ga401
machines/calcite/configuration.nix
(mkHome "xin" "calcite")
2023-04-16 02:30:45 +00:00
];
};
2023-07-29 15:34:24 +00:00
nixosConfigurations.massicot = mkNixos {
system = "aarch64-linux";
modules = [
machines/massicot
2023-09-11 12:20:32 +00:00
(mkHome "xin" "raspite")
];
};
2023-07-29 15:34:24 +00:00
2023-04-23 03:06:57 +00:00
nixosConfigurations.raspite = mkNixos {
2023-04-16 05:18:23 +00:00
system = "aarch64-linux";
modules = [
nixos-hardware.nixosModules.raspberry-pi-4
2023-04-23 03:06:57 +00:00
machines/raspite/configuration.nix
(mkHome "xin" "raspite")
2023-04-16 05:18:23 +00:00
];
};
2023-04-23 03:06:57 +00:00
images.raspite = (mkNixos {
2023-04-16 05:18:23 +00:00
system = "aarch64-linux";
modules = [
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
nixos-hardware.nixosModules.raspberry-pi-4
2023-04-23 03:06:57 +00:00
machines/raspite/configuration.nix
2023-04-16 05:18:23 +00:00
{
nixpkgs.config.allowUnsupportedSystem = true;
nixpkgs.hostPlatform.system = "aarch64-linux";
nixpkgs.buildPlatform.system = "x86_64-linux";
}
];
}).config.system.build.sdImage;
} //
(with flake-utils.lib; (eachSystem defaultSystems (system:
let pkgs = import nixpkgs { inherit system; }; in
{
packages = {
homeConfigurations."xin" = import ./home/xin/gold { inherit home-manager pkgs; };
};
}
)));
2023-03-29 13:14:37 +00:00
}