diff --git a/nix_flake/flake.lock b/nix_flake/flake.lock index ab71d6f..3ae3fe9 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-9DWcuVadnJPko8LjBbV7nnYhCBc2VGQKKfo5QYUJFk0=", + "path": "..", + "type": "path" + }, + "original": { + "path": "..", + "type": "path" + } + }, "utils": { "locked": { "lastModified": 1648297722, diff --git a/nix_flake/flake.nix b/nix_flake/flake.nix index 9f86091..0a687b8 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,7 +16,7 @@ # `nix build` packages.quickpeep = naersk-lib.buildPackage { pname = "quickpeep"; - root = ./..; + root = src; buildInputs = with pkgs; [ openssl pkgconfig @@ -39,7 +41,7 @@ # NixOS Modules nixosModules = { - quickpeepSearch = import ./modules/quickpeepSearch.nix; + quickpeepSearch = import ./modules/quickpeepSearch.nix self; }; # `nix run` diff --git a/nix_flake/modules/quickpeepSearch.nix b/nix_flake/modules/quickpeepSearch.nix index 356cbe4..0e83383 100644 --- a/nix_flake/modules/quickpeepSearch.nix +++ b/nix_flake/modules/quickpeepSearch.nix @@ -1,7 +1,8 @@ -{config, pkgs, lib, quickpeep, ...}: +flake: {config, pkgs, lib, ...}: let cfg = config.services.quickpeepSearch; + inherit (flake.packages.${pkgs.stdenv.hostPlatform.system}) quickpeep; in with lib; @@ -19,7 +20,7 @@ with lib; user = mkOption { default = "quickpeep"; - type = with types; uniq string; + type = with types; uniq str; description = '' Name of the user. ''; @@ -27,7 +28,7 @@ with lib; bindHost = mkOption { default = "127.0.0.1"; - type = with types; string; + type = with types; str; description = '' Host upon which to bind the web interface. ''; @@ -44,6 +45,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.quickpeepSearch = { wantedBy = [ "multi-user.target" ]; after = [ "network.target" ]; @@ -51,11 +59,8 @@ with lib; serviceConfig = { Type = "simple"; User = "${cfg.user}"; - ExecStart = ''${quickpeep.quickpeep}/bin/quickpeep ${cfg.bindHost}:${cfg.bindPort}''; + ExecStart = ''${quickpeep}/bin/quickpeep ${cfg.bindHost}:${builtins.toString cfg.bindPort}''; }; }; - - # TODO Do we need to specify quickpeep here? - environment.systemPackages = [ quickpeep.quickpeep ]; }; } diff --git a/nix_flake/test_vm/flake.lock b/nix_flake/test_vm/flake.lock index 631677b..c9e473c 100644 --- a/nix_flake/test_vm/flake.lock +++ b/nix_flake/test_vm/flake.lock @@ -102,11 +102,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1648383610, - "narHash": "sha256-egKvd+S5FEpjwK2aCoJ+NrBG2m+9Njl4I1OXrDTZHvE=", + "lastModified": 1649117019, + "narHash": "sha256-ID7nw/8MDgqj/cbJ0wy6AtQ9wp58hSnE6+weZwuHnso=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7a3f9d626c8a88141077ab99d8352469aa6feeb7", + "rev": "ccb90fb9e11459aeaf83cc28d5f8910816d90dd0", "type": "github" }, "original": { @@ -148,10 +148,11 @@ "inputs": { "naersk": "naersk", "nixpkgs": "nixpkgs_4", + "src": "src", "utils": "utils" }, "locked": { - "narHash": "sha256-sIsKWG16MmzhkFFyHBgRPeSnREpDY1ylPjCBKhogsjs=", + "narHash": "sha256-ottHXBWVE2yM6xPwbKQuBL39BZTa1hlMYR30QA7TmzY=", "path": "..", "type": "path" }, @@ -168,6 +169,18 @@ "quickpeep": "quickpeep" } }, + "src": { + "flake": false, + "locked": { + "narHash": "sha256-9DWcuVadnJPko8LjBbV7nnYhCBc2VGQKKfo5QYUJFk0=", + "path": "..", + "type": "path" + }, + "original": { + "path": "..", + "type": "path" + } + }, "utils": { "locked": { "lastModified": 1648297722,