Update nix

This commit is contained in:
George Shammas 2023-11-26 17:35:43 -05:00
parent 056e0c2414
commit a6b63572b1
No known key found for this signature in database
4 changed files with 62 additions and 32 deletions

View File

@ -1,9 +1,13 @@
(import ( (import
let (
lock = builtins.fromJSON (builtins.readFile ./flake.lock); let
in fetchTarball { lock = builtins.fromJSON (builtins.readFile ./flake.lock);
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; in
sha256 = lock.nodes.flake-compat.locked.narHash; } fetchTarball {
) { url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
src = ./.; sha256 = lock.nodes.flake-compat.locked.narHash;
}).defaultNix }
)
{
src = ./.;
}).defaultNix

View File

@ -3,11 +3,11 @@
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1673956053, "lastModified": 1696426674,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -18,11 +18,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1685616147, "lastModified": 1701037719,
"narHash": "sha256-Y2BAkfSSCkH/SNIG2glh9vbdiQyWAFWr5Q4K0JgChlg=", "narHash": "sha256-iRugJrfdbc4rBybmtl09L3e2KseKjjjx8H9eUEuMO4M=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4e80f80864db80ef05482325a379243c41f925fa", "rev": "627af21e87ce5d6a456f485292ac4ac2bc1f469f",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -12,10 +12,11 @@
version = builtins.replaceStrings [ "\n" ] [ "" ] version = builtins.replaceStrings [ "\n" ] [ "" ]
(builtins.readFile ./.version + versionSuffix); (builtins.readFile ./.version + versionSuffix);
versionSuffix = if officialRelease then versionSuffix =
"" if officialRelease then
else ""
"pre${ else
"pre${
nixpkgs.lib.substring 0 8 (self.lastModifiedDate or self.lastModified) nixpkgs.lib.substring 0 8 (self.lastModifiedDate or self.lastModified)
}_${self.shortRev or "dirty"}"; }_${self.shortRev or "dirty"}";
@ -30,7 +31,8 @@
inherit system; inherit system;
overlays = [ self.overlay ]; overlays = [ self.overlay ];
}); });
in { in
{
overlay = final: prev: { overlay = final: prev: {
ifconfigio = with final; ifconfigio = with final;
with pkgs; with pkgs;
@ -38,7 +40,7 @@
name = "ifconfig.io-${version}"; name = "ifconfig.io-${version}";
src = self; src = self;
vendorSha256 = "sha256-FnIJff+T5bB3HKET5srQibXnyHjbOVIgcKEoViSY6TA="; vendorHash = "sha256-ZtKaYvPGP7L18pwtglFJJngDAVchiOsLKYWuT5YkcLk=";
tags = [ "jsoniter" ]; tags = [ "jsoniter" ];
@ -70,15 +72,35 @@
defaultPackage = defaultPackage =
forAllSystems (system: self.packages.${system}.ifconfigio); forAllSystems (system: self.packages.${system}.ifconfigio);
nixosModules.ifconfigio = { pkgs, ... }: { nixosModules.ifconfigio = { pkgs, lib, ... }: {
nixpkgs.overlays = [ self.overlay ]; nixpkgs.overlays = [ self.overlay ];
systemd.packages = [ pkgs.ifconfigio ];
users.users.ifconfigio = { users.users.ifconfigio = {
description = "ifconfig.io daemon user"; description = "ifconfig.io daemon user";
group = "ifconfigio"; group = "ifconfigio";
isSystemUser = true; isSystemUser = true;
home = "/opt/ifconfig";
}; };
users.groups.ifconfigio = { }; users.groups.ifconfigio = { };
systemd.services.ifconfigio = {
description = "ifconfig.io web service";
enable = true;
wantedBy = [ "multi-user.target" ];
environment = {
GIN_MODE = lib.mkDefault "release";
TLS = lib.mkDefault "0";
};
script = ''
# For some reason the systemd WorkingDir is not doing what we need
# so we `cd` to it explicitly.
cd "${pkgs.ifconfigio}/usr/lib/ifconfig.io"
exec "${pkgs.ifconfigio}/bin/ifconfig.io"
'';
serviceConfig = {
User = "ifconfigio";
WorkingDir = "${pkgs.ifconfigio}/usr/lib/ifconfig.io";
LimitNOFILE = 200000;
};
};
}; };
}; };

View File

@ -1,9 +1,13 @@
(import ( (import
let (
lock = builtins.fromJSON (builtins.readFile ./flake.lock); let
in fetchTarball { lock = builtins.fromJSON (builtins.readFile ./flake.lock);
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; in
sha256 = lock.nodes.flake-compat.locked.narHash; } fetchTarball {
) { url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
src = ./.; sha256 = lock.nodes.flake-compat.locked.narHash;
}).shellNix }
)
{
src = ./.;
}).shellNix