Use devshell instead of pkgs.mkShell

This commit is contained in:
Charlotte Van Petegem 2022-04-30 13:49:05 +02:00
parent d70902ba8a
commit 4d3df0103f
No known key found for this signature in database
GPG key ID: 019E764B7184435A
4 changed files with 101 additions and 189 deletions

222
flake.lock generated
View file

@ -3,17 +3,23 @@
"accentor": { "accentor": {
"inputs": { "inputs": {
"api": "api", "api": "api",
"devshell": [
"devshell"
],
"flake-utils": [
"flake-utils"
],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"web": "web" "web": "web"
}, },
"locked": { "locked": {
"lastModified": 1651316741, "lastModified": 1651318782,
"narHash": "sha256-/JhwvKbPhT0y7giKAVYsak6NEIOyKerDWgYRUi0W7Mo=", "narHash": "sha256-Z+2OjUL+7GjDVV/1rRQ5TE7Q/iatDeQhxlYjnqmUmcM=",
"owner": "accentor", "owner": "accentor",
"repo": "flake", "repo": "flake",
"rev": "7c76067fa790887de58a074ddf3f2e5de3a8c809", "rev": "27eeab17ce07df7d6325d99df2bacc0cd503bb35",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -24,8 +30,12 @@
}, },
"accentor-api": { "accentor-api": {
"inputs": { "inputs": {
"devshell": "devshell_3", "devshell": [
"flake-utils": "flake-utils_3", "devshell"
],
"flake-utils": [
"flake-utils"
],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
@ -46,8 +56,12 @@
}, },
"accentor-web": { "accentor-web": {
"inputs": { "inputs": {
"devshell": "devshell_4", "devshell": [
"flake-utils": "flake-utils_4", "devshell"
],
"flake-utils": [
"flake-utils"
],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
@ -88,8 +102,14 @@
}, },
"api": { "api": {
"inputs": { "inputs": {
"devshell": "devshell", "devshell": [
"flake-utils": "flake-utils", "accentor",
"devshell"
],
"flake-utils": [
"accentor",
"flake-utils"
],
"nixpkgs": [ "nixpkgs": [
"accentor", "accentor",
"nixpkgs" "nixpkgs"
@ -129,99 +149,18 @@
"devshell": { "devshell": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
"accentor",
"api",
"flake-utils" "flake-utils"
], ],
"nixpkgs": [ "nixpkgs": [
"accentor",
"api",
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1650201426, "lastModified": 1650900878,
"narHash": "sha256-u43Xf03ImFJWKLHddtjOpCJCHbuM0SQbb6FKR5NuFhk=", "narHash": "sha256-qhNncMBSa9STnhiLfELEQpYC1L4GrYHNIzyCZ/pilsI=",
"owner": "numtide", "owner": "numtide",
"repo": "devshell", "repo": "devshell",
"rev": "cb76bc75a0ee81f2d8676fe681f268c48dbd380e", "rev": "d97df53b5ddaa1cfbea7cddbd207eb2634304733",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"devshell_2": {
"inputs": {
"flake-utils": [
"accentor",
"web",
"flake-utils"
],
"nixpkgs": [
"accentor",
"web",
"nixpkgs"
]
},
"locked": {
"lastModified": 1650201426,
"narHash": "sha256-u43Xf03ImFJWKLHddtjOpCJCHbuM0SQbb6FKR5NuFhk=",
"owner": "numtide",
"repo": "devshell",
"rev": "cb76bc75a0ee81f2d8676fe681f268c48dbd380e",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"devshell_3": {
"inputs": {
"flake-utils": [
"accentor-api",
"flake-utils"
],
"nixpkgs": [
"accentor-api",
"nixpkgs"
]
},
"locked": {
"lastModified": 1650201426,
"narHash": "sha256-u43Xf03ImFJWKLHddtjOpCJCHbuM0SQbb6FKR5NuFhk=",
"owner": "numtide",
"repo": "devshell",
"rev": "cb76bc75a0ee81f2d8676fe681f268c48dbd380e",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"devshell_4": {
"inputs": {
"flake-utils": [
"accentor-web",
"flake-utils"
],
"nixpkgs": [
"accentor-web",
"nixpkgs"
]
},
"locked": {
"lastModified": 1650201426,
"narHash": "sha256-u43Xf03ImFJWKLHddtjOpCJCHbuM0SQbb6FKR5NuFhk=",
"owner": "numtide",
"repo": "devshell",
"rev": "cb76bc75a0ee81f2d8676fe681f268c48dbd380e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -260,66 +199,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": {
"locked": {
"lastModified": 1649676176,
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"locked": {
"lastModified": 1649676176,
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_4": {
"locked": {
"lastModified": 1649676176,
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_5": {
"locked": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -346,7 +225,9 @@
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"utils": "utils" "utils": [
"flake-utils"
]
}, },
"locked": { "locked": {
"lastModified": 1650133068, "lastModified": 1650133068,
@ -399,13 +280,15 @@
"accentor-api": "accentor-api", "accentor-api": "accentor-api",
"accentor-web": "accentor-web", "accentor-web": "accentor-web",
"agenix": "agenix", "agenix": "agenix",
"devshell": "devshell",
"emacs-overlay": "emacs-overlay", "emacs-overlay": "emacs-overlay",
"flake-utils": "flake-utils",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixos-mailserver": "nixos-mailserver", "nixos-mailserver": "nixos-mailserver",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nur": "nur", "nur": "nur",
"tetris": "tetris", "tetris": "tetris",
"utils": "utils_2" "utils": "utils"
} }
}, },
"tetris": { "tetris": {
@ -429,23 +312,10 @@
} }
}, },
"utils": { "utils": {
"locked": {
"lastModified": 1605370193,
"narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5021eac20303a61fafe17224c087f5519baed54d",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"utils_2": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_5" "flake-utils": [
"flake-utils"
]
}, },
"locked": { "locked": {
"lastModified": 1647259887, "lastModified": 1647259887,
@ -463,8 +333,14 @@
}, },
"web": { "web": {
"inputs": { "inputs": {
"devshell": "devshell_2", "devshell": [
"flake-utils": "flake-utils_2", "accentor",
"devshell"
],
"flake-utils": [
"accentor",
"flake-utils"
],
"nixpkgs": [ "nixpkgs": [
"accentor", "accentor",
"nixpkgs" "nixpkgs"

View file

@ -4,28 +4,51 @@
inputs = { inputs = {
accentor = { accentor = {
url = "github:accentor/flake"; url = "github:accentor/flake";
inputs.nixpkgs.follows = "nixpkgs"; inputs = {
devshell.follows = "devshell";
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
}; };
accentor-api = { accentor-api = {
url = "github:accentor/api"; url = "github:accentor/api";
inputs.nixpkgs.follows = "nixpkgs"; inputs = {
devshell.follows = "devshell";
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
}; };
accentor-web = { accentor-web = {
url = "github:accentor/web"; url = "github:accentor/web";
inputs.nixpkgs.follows = "nixpkgs"; inputs = {
devshell.follows = "devshell";
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
}; };
agenix = { agenix = {
url = "github:ryantm/agenix"; url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
devshell = {
url = "github:numtide/devshell";
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
emacs-overlay.url = "github:nix-community/emacs-overlay"; emacs-overlay.url = "github:nix-community/emacs-overlay";
flake-utils.url = "github:numtide/flake-utils";
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nixos-mailserver = { nixos-mailserver = {
url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
inputs.nixpkgs.follows = "nixpkgs"; inputs = {
nixpkgs.follows = "nixpkgs";
utils.follows = "flake-utils";
};
}; };
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nur.url = "github:nix-community/NUR"; nur.url = "github:nix-community/NUR";
@ -33,10 +56,16 @@
url = "github:chvp/tetris"; url = "github:chvp/tetris";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
utils.url = "github:gytis-ivaskevicius/flake-utils-plus"; utils = {
url = "github:gytis-ivaskevicius/flake-utils-plus";
inputs = {
flake-utils.follows = "flake-utils";
devshell.follows = "devshell";
};
};
}; };
outputs = inputs@{ self, nixpkgs, accentor, accentor-api, accentor-web, agenix, emacs-overlay, home-manager, nixos-mailserver, nur, tetris, utils }: outputs = inputs@{ self, nixpkgs, accentor, accentor-api, accentor-web, agenix, devshell, emacs-overlay, flake-utils, home-manager, nixos-mailserver, nur, tetris, utils }:
let let
customPackages = callPackage: { customPackages = callPackage: {
jdtls = callPackage ./packages/jdtls { }; jdtls = callPackage ./packages/jdtls { };
@ -48,6 +77,7 @@
input = nixpkgs; input = nixpkgs;
patches = map (patch: ./patches + "/${patch}") (builtins.filter (x: x != ".keep") (builtins.attrNames (builtins.readDir ./patches))); patches = map (patch: ./patches + "/${patch}") (builtins.filter (x: x != ".keep") (builtins.attrNames (builtins.readDir ./patches)));
overlaysBuilder = _: [ overlaysBuilder = _: [
devshell.overlay
emacs-overlay.overlay emacs-overlay.overlay
(self: super: customPackages self.callPackage) (self: super: customPackages self.callPackage)
(self: super: { (self: super: {
@ -92,12 +122,16 @@
let pkgs = channels.nixpkgs; in let pkgs = channels.nixpkgs; in
{ {
packages = customPackages pkgs.callPackage; packages = customPackages pkgs.callPackage;
devShell = pkgs.mkShell { devShells = rec {
buildInputs = [ default = nixos-config;
pkgs.nixpkgs-fmt nixos-config = pkgs.devshell.mkShell {
(pkgs.writeShellScriptBin "fetchpatch" "curl -L https://github.com/NixOS/nixpkgs/pull/$1.patch -o patches/$1.patch") name = "NixOS config";
agenix.defaultPackage.x86_64-linux packages = [
]; pkgs.nixpkgs-fmt
(pkgs.writeShellScriptBin "fetchpatch" "curl -L https://github.com/NixOS/nixpkgs/pull/$1.patch -o patches/$1.patch")
agenix.defaultPackage.x86_64-linux
];
};
}; };
}; };
}; };

View file

@ -1,9 +1,11 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
garmin2influx = pkgs.writers.writePython3Bin "garmin2influx" { garmin2influx = pkgs.writers.writePython3Bin "garmin2influx"
libraries = with pkgs.python3Packages; [ garminconnect influxdb-client ]; {
} (builtins.readFile ./garmin2influx.py); libraries = with pkgs.python3Packages; [ garminconnect influxdb-client ];
}
(builtins.readFile ./garmin2influx.py);
in in
{ {
options.chvp.services.garmin-scraper.enable = lib.mkEnableOption "garmin scraper"; options.chvp.services.garmin-scraper.enable = lib.mkEnableOption "garmin scraper";

View file

@ -17,7 +17,7 @@
}; };
networking.firewall.allowedTCPPorts = [ 8086 ]; networking.firewall.allowedTCPPorts = [ 8086 ];
services = { services = {
nginx.upstreams.grafana.servers = { "unix:/run/grafana/grafana.sock" = {}; }; nginx.upstreams.grafana.servers = { "unix:/run/grafana/grafana.sock" = { }; };
influxdb2 = { influxdb2 = {
enable = true; enable = true;
settings = { settings = {