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 (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash; }
) {
src = ./.;
}).defaultNix
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{
src = ./.;
}).defaultNix

View File

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

View File

@ -12,10 +12,11 @@
version = builtins.replaceStrings [ "\n" ] [ "" ]
(builtins.readFile ./.version + versionSuffix);
versionSuffix = if officialRelease then
""
else
"pre${
versionSuffix =
if officialRelease then
""
else
"pre${
nixpkgs.lib.substring 0 8 (self.lastModifiedDate or self.lastModified)
}_${self.shortRev or "dirty"}";
@ -30,7 +31,8 @@
inherit system;
overlays = [ self.overlay ];
});
in {
in
{
overlay = final: prev: {
ifconfigio = with final;
with pkgs;
@ -38,7 +40,7 @@
name = "ifconfig.io-${version}";
src = self;
vendorSha256 = "sha256-FnIJff+T5bB3HKET5srQibXnyHjbOVIgcKEoViSY6TA=";
vendorHash = "sha256-ZtKaYvPGP7L18pwtglFJJngDAVchiOsLKYWuT5YkcLk=";
tags = [ "jsoniter" ];
@ -70,15 +72,35 @@
defaultPackage =
forAllSystems (system: self.packages.${system}.ifconfigio);
nixosModules.ifconfigio = { pkgs, ... }: {
nixosModules.ifconfigio = { pkgs, lib, ... }: {
nixpkgs.overlays = [ self.overlay ];
systemd.packages = [ pkgs.ifconfigio ];
users.users.ifconfigio = {
description = "ifconfig.io daemon user";
group = "ifconfigio";
isSystemUser = true;
home = "/opt/ifconfig";
};
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 (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash; }
) {
src = ./.;
}).shellNix
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{
src = ./.;
}).shellNix