diff --git a/nix_flake/flake.lock b/nix_flake/flake.lock index 41fa965..db71eb0 100644 --- a/nix_flake/flake.lock +++ b/nix_flake/flake.lock @@ -50,9 +50,22 @@ "inputs": { "naersk": "naersk", "nixpkgs": "nixpkgs_2", + "src": "src", "utils": "utils" } }, + "src": { + "flake": false, + "locked": { + "narHash": "sha256-8vp3LGoPRzhitzLCbTS7QnCz89bsVn48oS2aXIwAmjU=", + "path": "..", + "type": "path" + }, + "original": { + "path": "..", + "type": "path" + } + }, "utils": { "locked": { "lastModified": 1648297722, diff --git a/nix_flake/flake.nix b/nix_flake/flake.nix index e86a07f..9d2b2e0 100644 --- a/nix_flake/flake.nix +++ b/nix_flake/flake.nix @@ -4,9 +4,11 @@ inputs = { utils.url = "github:numtide/flake-utils"; naersk.url = "github:nix-community/naersk"; + src.url = "path:.."; + src.flake = false; }; - outputs = { self, nixpkgs, utils, naersk }: + outputs = { self, nixpkgs, utils, naersk, src }: utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages."${system}"; naersk-lib = naersk.lib."${system}"; @@ -14,14 +16,15 @@ # `nix build` packages.hallo = naersk-lib.buildPackage { pname = "hallo"; - root = ./..; + #root = ./..; + root = src; }; defaultPackage = packages.hallo; # NixOS Modules nixosModules = { - halloSvc = import ./modules/halloSvc.nix; + halloSvc = import ./modules/halloSvc.nix self; }; # `nix run` diff --git a/nix_flake/modules/halloSvc.nix b/nix_flake/modules/halloSvc.nix index 3e3bcd4..40616e0 100644 --- a/nix_flake/modules/halloSvc.nix +++ b/nix_flake/modules/halloSvc.nix @@ -1,7 +1,8 @@ -{config, pkgs, lib, hallo, ...}: +flake: {config, pkgs, lib, hallo, ...}: let cfg = config.services.halloSvc; + inherit (flake.packages.${pkgs.stdenv.hostPlatform.system}) hallo; in with lib; @@ -28,6 +29,13 @@ with lib; }; config = mkIf cfg.enable { + users.users."${cfg.user}" = { + description = "Hallo daemon user"; + isSystemUser = true; + group = "${cfg.user}"; + }; + users.groups."${cfg.user}" = {}; + systemd.services.halloSvc = { wantedBy = [ "multi-user.target" ]; after = [ "network.target" ]; @@ -35,10 +43,8 @@ with lib; serviceConfig = { Type = "simple"; User = "${cfg.user}"; - ExecStart = ''${hallo.hallo}/bin/hallo''; + ExecStart = ''${hallo}/bin/hallo''; }; }; - - environment.systemPackages = [ hallo.hello ]; }; } diff --git a/nix_flake/test_vm/flake.lock b/nix_flake/test_vm/flake.lock index 8a5ec9e..58e28e4 100644 --- a/nix_flake/test_vm/flake.lock +++ b/nix_flake/test_vm/flake.lock @@ -19,10 +19,11 @@ "inputs": { "naersk": "naersk", "nixpkgs": "nixpkgs_2", + "src": "src", "utils": "utils" }, "locked": { - "narHash": "sha256-LyX46m+YB08861YXrWWmdUTT9uQtyjE96/1beyeETbM=", + "narHash": "sha256-4TE+4kf1Q4LqorKsKRrspJYm8iHGX6XtMQLXG5+IN7k=", "path": "..", "type": "path" }, @@ -146,11 +147,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1649024309, - "narHash": "sha256-AWbvj/NHZXVwAnHaVOFlxg7tcNerEKrKBmgGfztSHWM=", + "lastModified": 1649117019, + "narHash": "sha256-ID7nw/8MDgqj/cbJ0wy6AtQ9wp58hSnE6+weZwuHnso=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "af0a9bc0e5341855518e9c1734d7ef913e5138b9", + "rev": "ccb90fb9e11459aeaf83cc28d5f8910816d90dd0", "type": "github" }, "original": { @@ -168,6 +169,18 @@ "nixpkgs": "nixpkgs_4" } }, + "src": { + "flake": false, + "locked": { + "narHash": "sha256-8vp3LGoPRzhitzLCbTS7QnCz89bsVn48oS2aXIwAmjU=", + "path": "..", + "type": "path" + }, + "original": { + "path": "..", + "type": "path" + } + }, "utils": { "locked": { "lastModified": 1648297722,