diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..ca19d95 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,25 @@ +{ nixosSystem, home-manager, lib, nixpkgs-unstable, ... }: { + sterni = nixosSystem { + system = "x86_64-linux"; + modules = [ + ./configs/sterni/configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + } + ({ pkgs, ... }: { + # defined overlays injected by the nixflake + nixpkgs.overlays = [ + (_self: _super: { + # we assign the overlay created before to the overlays of nixpkgs. + unstable = nixpkgs-unstable.legacyPackages.${pkgs.system}; + }) + ]; + + # imports of modules + imports = [ ]; + }) + ]; + }; +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..56dea5a --- /dev/null +++ b/flake.nix @@ -0,0 +1,50 @@ +{ + + description = "my krops file"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-21.05"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + nix-doom-emacs = { + url = "github:vlaci/nix-doom-emacs"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + home-manager = { + url = "github:nix-community/home-manager/release-21.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + krops = { + url = "github:Mic92/krops"; + #url = "file:/home/palo/dev/krops-mic92-fork"; + inputs.flake-utils.follows = "flake-utils"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, home-manager, krops, flake-utils, nix-doom-emacs + , nixpkgs-unstable, ... }: + (flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: + let + + pkgs = nixpkgs.legacyPackages.${system}; + writeCommand = krops.packages.${system}.writeCommand; + + in { + + # deploy like this: + # nix run ".#deploy.sterni" + apps.deploy = pkgs.callPackage ./krops.nix { + inherit writeCommand; + lib = krops.lib; + }; + + })) // { + nixosConfigurations = import ./configurations.nix { + nixosSystem = nixpkgs.lib.nixosSystem; + inherit home-manager nixpkgs-unstable lib; + }; + + }; + +} diff --git a/krops.nix b/krops.nix new file mode 100644 index 0000000..a683634 --- /dev/null +++ b/krops.nix @@ -0,0 +1,60 @@ +{ writeCommand, lib, ... }: +let + + secrets = name: { + secrets.pass = { + dir = toString ~/.password-store; + name = "krops/${name}/secrets"; + }; + common_secrets.pass = { + dir = toString ~/.password-store; + name = "krops/common_secrets"; + }; + }; + + desktopSecrets = { + desktop_secrets.pass = { + dir = toString ~/.password-store; + name = "krops/desktop_secrets"; + }; + }; + + source = { + + # only workhorse + # property.file = toString ./submodules/property; + + assets.file = toString ./assets; + configs.file = toString ./configs; + library.file = toString ./library; + modules.file = toString ./modules; + #mqtt.file = toString ./mqtt; + pkgs.file = toString ./pkgs; + system.file = toString ./system; + + #backup-module.file = toString ~/dev/backup; + backup-module.git = { + url = "https://git.ingolf-wagner.de/nix-modules/backup.git"; + ref = "1.3.3"; + }; + + #kops-lib.file = toString ~/dev/krops-lib; + krops-lib.git = { + url = "https://git.ingolf-wagner.de/nix-modules/krops.git"; + ref = "1.0.3"; + }; + + #cluster-module.file = toString ~/dev/cluster-module; + cluster-module.git = { + url = "https://git.ingolf-wagner.de/nix-modules/cluster.git"; + ref = "1.2.0"; + }; + + }; + +in { + sterni = writeCommand "deploy-sterni" { + source = source // (secrets "sterni") // desktopSecrets; + target = lib.mkTarget "root@sterni.private"; + }; +}