From 4d3df0103f01accfc259fb0a871c97b35fbe06ac Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Sat, 30 Apr 2022 13:49:05 +0200 Subject: [PATCH] Use devshell instead of pkgs.mkShell --- flake.lock | 222 +++++--------------- flake.nix | 58 +++-- modules/services/garmin-scraper/default.nix | 8 +- modules/services/grafana/default.nix | 2 +- 4 files changed, 101 insertions(+), 189 deletions(-) diff --git a/flake.lock b/flake.lock index 2d721489..a2506661 100644 --- a/flake.lock +++ b/flake.lock @@ -3,17 +3,23 @@ "accentor": { "inputs": { "api": "api", + "devshell": [ + "devshell" + ], + "flake-utils": [ + "flake-utils" + ], "nixpkgs": [ "nixpkgs" ], "web": "web" }, "locked": { - "lastModified": 1651316741, - "narHash": "sha256-/JhwvKbPhT0y7giKAVYsak6NEIOyKerDWgYRUi0W7Mo=", + "lastModified": 1651318782, + "narHash": "sha256-Z+2OjUL+7GjDVV/1rRQ5TE7Q/iatDeQhxlYjnqmUmcM=", "owner": "accentor", "repo": "flake", - "rev": "7c76067fa790887de58a074ddf3f2e5de3a8c809", + "rev": "27eeab17ce07df7d6325d99df2bacc0cd503bb35", "type": "github" }, "original": { @@ -24,8 +30,12 @@ }, "accentor-api": { "inputs": { - "devshell": "devshell_3", - "flake-utils": "flake-utils_3", + "devshell": [ + "devshell" + ], + "flake-utils": [ + "flake-utils" + ], "nixpkgs": [ "nixpkgs" ] @@ -46,8 +56,12 @@ }, "accentor-web": { "inputs": { - "devshell": "devshell_4", - "flake-utils": "flake-utils_4", + "devshell": [ + "devshell" + ], + "flake-utils": [ + "flake-utils" + ], "nixpkgs": [ "nixpkgs" ] @@ -88,8 +102,14 @@ }, "api": { "inputs": { - "devshell": "devshell", - "flake-utils": "flake-utils", + "devshell": [ + "accentor", + "devshell" + ], + "flake-utils": [ + "accentor", + "flake-utils" + ], "nixpkgs": [ "accentor", "nixpkgs" @@ -129,99 +149,18 @@ "devshell": { "inputs": { "flake-utils": [ - "accentor", - "api", "flake-utils" ], "nixpkgs": [ - "accentor", - "api", "nixpkgs" ] }, "locked": { - "lastModified": 1650201426, - "narHash": "sha256-u43Xf03ImFJWKLHddtjOpCJCHbuM0SQbb6FKR5NuFhk=", + "lastModified": 1650900878, + "narHash": "sha256-qhNncMBSa9STnhiLfELEQpYC1L4GrYHNIzyCZ/pilsI=", "owner": "numtide", "repo": "devshell", - "rev": "cb76bc75a0ee81f2d8676fe681f268c48dbd380e", - "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", + "rev": "d97df53b5ddaa1cfbea7cddbd207eb2634304733", "type": "github" }, "original": { @@ -260,66 +199,6 @@ "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": { "inputs": { "nixpkgs": [ @@ -346,7 +225,9 @@ "nixpkgs": [ "nixpkgs" ], - "utils": "utils" + "utils": [ + "flake-utils" + ] }, "locked": { "lastModified": 1650133068, @@ -399,13 +280,15 @@ "accentor-api": "accentor-api", "accentor-web": "accentor-web", "agenix": "agenix", + "devshell": "devshell", "emacs-overlay": "emacs-overlay", + "flake-utils": "flake-utils", "home-manager": "home-manager", "nixos-mailserver": "nixos-mailserver", "nixpkgs": "nixpkgs", "nur": "nur", "tetris": "tetris", - "utils": "utils_2" + "utils": "utils" } }, "tetris": { @@ -429,23 +312,10 @@ } }, "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": { - "flake-utils": "flake-utils_5" + "flake-utils": [ + "flake-utils" + ] }, "locked": { "lastModified": 1647259887, @@ -463,8 +333,14 @@ }, "web": { "inputs": { - "devshell": "devshell_2", - "flake-utils": "flake-utils_2", + "devshell": [ + "accentor", + "devshell" + ], + "flake-utils": [ + "accentor", + "flake-utils" + ], "nixpkgs": [ "accentor", "nixpkgs" diff --git a/flake.nix b/flake.nix index f97278c2..4dcfae0d 100644 --- a/flake.nix +++ b/flake.nix @@ -4,28 +4,51 @@ inputs = { accentor = { url = "github:accentor/flake"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs = { + devshell.follows = "devshell"; + flake-utils.follows = "flake-utils"; + nixpkgs.follows = "nixpkgs"; + }; }; accentor-api = { url = "github:accentor/api"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs = { + devshell.follows = "devshell"; + flake-utils.follows = "flake-utils"; + nixpkgs.follows = "nixpkgs"; + }; }; accentor-web = { url = "github:accentor/web"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs = { + devshell.follows = "devshell"; + flake-utils.follows = "flake-utils"; + nixpkgs.follows = "nixpkgs"; + }; }; agenix = { url = "github:ryantm/agenix"; 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"; + flake-utils.url = "github:numtide/flake-utils"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; 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"; nur.url = "github:nix-community/NUR"; @@ -33,10 +56,16 @@ url = "github:chvp/tetris"; 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 customPackages = callPackage: { jdtls = callPackage ./packages/jdtls { }; @@ -48,6 +77,7 @@ input = nixpkgs; patches = map (patch: ./patches + "/${patch}") (builtins.filter (x: x != ".keep") (builtins.attrNames (builtins.readDir ./patches))); overlaysBuilder = _: [ + devshell.overlay emacs-overlay.overlay (self: super: customPackages self.callPackage) (self: super: { @@ -92,12 +122,16 @@ let pkgs = channels.nixpkgs; in { packages = customPackages pkgs.callPackage; - devShell = pkgs.mkShell { - buildInputs = [ - 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 - ]; + devShells = rec { + default = nixos-config; + nixos-config = pkgs.devshell.mkShell { + name = "NixOS config"; + 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 + ]; + }; }; }; }; diff --git a/modules/services/garmin-scraper/default.nix b/modules/services/garmin-scraper/default.nix index 6fefde55..74f55d58 100644 --- a/modules/services/garmin-scraper/default.nix +++ b/modules/services/garmin-scraper/default.nix @@ -1,9 +1,11 @@ { config, lib, pkgs, ... }: let - garmin2influx = pkgs.writers.writePython3Bin "garmin2influx" { - libraries = with pkgs.python3Packages; [ garminconnect influxdb-client ]; - } (builtins.readFile ./garmin2influx.py); + garmin2influx = pkgs.writers.writePython3Bin "garmin2influx" + { + libraries = with pkgs.python3Packages; [ garminconnect influxdb-client ]; + } + (builtins.readFile ./garmin2influx.py); in { options.chvp.services.garmin-scraper.enable = lib.mkEnableOption "garmin scraper"; diff --git a/modules/services/grafana/default.nix b/modules/services/grafana/default.nix index e0e83a7b..2186ef22 100644 --- a/modules/services/grafana/default.nix +++ b/modules/services/grafana/default.nix @@ -17,7 +17,7 @@ }; networking.firewall.allowedTCPPorts = [ 8086 ]; services = { - nginx.upstreams.grafana.servers = { "unix:/run/grafana/grafana.sock" = {}; }; + nginx.upstreams.grafana.servers = { "unix:/run/grafana/grafana.sock" = { }; }; influxdb2 = { enable = true; settings = {