This commit is contained in:
2025-08-03 20:35:48 +02:00
parent ffc78043e6
commit 2ddffc74c9
17 changed files with 476 additions and 333 deletions

View File

@@ -32,28 +32,55 @@
flake = false;
};
};
outputs = { self, darwin, nix-homebrew, homebrew-bundle, homebrew-core, homebrew-cask, home-manager, nixpkgs, disko, agenix, secrets } @inputs:
outputs =
{
self,
darwin,
nix-homebrew,
homebrew-bundle,
homebrew-core,
homebrew-cask,
home-manager,
nixpkgs,
disko,
agenix,
secrets,
}@inputs:
let
user = "cschmatzler";
linuxSystems = [ "x86_64-linux" ];
darwinSystems = [ "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs (linuxSystems ++ darwinSystems) f;
devShell = system: let pkgs = nixpkgs.legacyPackages.${system}; in {
default = with pkgs; mkShell {
nativeBuildInputs = with pkgs; [ bashInteractive git age age-plugin-yubikey ];
shellHook = with pkgs; ''
export EDITOR=vim
'';
devShell =
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default =
with pkgs;
mkShell {
nativeBuildInputs = with pkgs; [
bashInteractive
git
age
age-plugin-yubikey
];
shellHook = with pkgs; ''
export EDITOR=vim
'';
};
};
};
mkApp = scriptName: system: {
type = "app";
program = "${(nixpkgs.legacyPackages.${system}.writeScriptBin scriptName ''
#!/usr/bin/env bash
PATH=${nixpkgs.legacyPackages.${system}.git}/bin:$PATH
echo "Running ${scriptName} for ${system}"
exec ${self}/apps/${system}/${scriptName}
'')}/bin/${scriptName}";
program = "${
(nixpkgs.legacyPackages.${system}.writeScriptBin scriptName ''
#!/usr/bin/env bash
PATH=${nixpkgs.legacyPackages.${system}.git}/bin:$PATH
echo "Running ${scriptName} for ${system}"
exec ${self}/apps/${system}/${scriptName}
'')
}/bin/${scriptName}";
};
mkLinuxApps = system: {
"apply" = mkApp "apply" system;
@@ -76,9 +103,11 @@
in
{
devShells = forAllSystems devShell;
apps = nixpkgs.lib.genAttrs linuxSystems mkLinuxApps // nixpkgs.lib.genAttrs darwinSystems mkDarwinApps;
apps =
nixpkgs.lib.genAttrs linuxSystems mkLinuxApps // nixpkgs.lib.genAttrs darwinSystems mkDarwinApps;
darwinConfigurations = nixpkgs.lib.genAttrs darwinSystems (system:
darwinConfigurations = nixpkgs.lib.genAttrs darwinSystems (
system:
darwin.lib.darwinSystem {
inherit system;
specialArgs = inputs;
@@ -103,20 +132,24 @@
}
);
nixosConfigurations = nixpkgs.lib.genAttrs linuxSystems (system: nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = inputs;
modules = [
disko.nixosModules.disko
home-manager.nixosModules.home-manager {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${user} = import ./modules/nixos/home-manager.nix;
};
}
./hosts/nixos
];
});
};
nixosConfigurations = nixpkgs.lib.genAttrs linuxSystems (
system:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = inputs;
modules = [
disko.nixosModules.disko
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${user} = import ./modules/nixos/home-manager.nix;
};
}
./hosts/nixos
];
}
);
};
}