add mkSystem and dev.nix

This commit is contained in:
uku 2023-11-14 17:36:02 +01:00
parent a261e122e6
commit 89f997e158
Signed by: uku
GPG key ID: 7D01D7B105E77166
3 changed files with 33 additions and 28 deletions

2
.envrc
View file

@ -1,2 +1,2 @@
use flake use flake
watch_file flake.nix watch_file dev.nix

14
dev.nix Normal file
View file

@ -0,0 +1,14 @@
{
perSystem = {pkgs, ...}: {
devShells.default = pkgs.mkShell {
packages = with pkgs; [
alejandra
fzf
just
nil
];
};
formatter = pkgs.alejandra;
};
}

View file

@ -41,42 +41,33 @@
flake-parts.lib.mkFlake {inherit inputs;} { flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux"]; systems = ["x86_64-linux"];
imports = [./dev.nix];
flake = let flake = let
mkSystem = name: mkSystem = modules: name:
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules =
./common.nix [
./${name} ./${name}
./${name}/hardware-configuration.nix ./${name}/hardware-configuration.nix
{networking.hostName = name;} {networking.hostName = name;}
]
++ modules;
specialArgs = inputs;
};
mkDesktop = mkSystem [
./common.nix
lanzaboote.nixosModules.lanzaboote lanzaboote.nixosModules.lanzaboote
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
]; ];
specialArgs = inputs;
};
in { in {
nixosConfigurations = nixpkgs.lib.genAttrs ["fuji" "kilimandjaro"] mkSystem; nixosConfigurations = {
fuji = mkDesktop "fuji";
kilimandjaro = mkDesktop "kilimandjaro";
}; };
perSystem = {system, ...}: let
pkgs = import nixpkgs {
inherit system;
};
in {
devShells.default = pkgs.mkShell {
packages = with pkgs; [
alejandra
fzf
just
nil
];
};
formatter = pkgs.alejandra;
}; };
}; };
} }