From 40dbc75827d30c0870acf22539e351fd96c431be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Mon, 2 May 2022 09:59:47 +0100 Subject: [PATCH] add statix check --- .build.yml | 3 ++- flake.nix | 5 ++-- nixos/boxes/bolty/tailscale-bolty.nix | 3 +-- .../boxes/foureighty/tailscale-foureighty.nix | 3 +-- nixos/boxes/skinnyv/tailscale-skinnyv.nix | 3 +-- nixos/boxes/thinky/tailscale-thinky.nix | 3 +-- nixos/boxes/vpsfree1/tailscale-vpsfree1.nix | 3 +-- nixos/boxes/vultr1/tailscale-vultr1.nix | 3 +-- nixos/common-hardware.nix | 2 +- nixos/email-accounts.nix | 2 +- nixos/home-manager/programs/emacs/emacs.nix | 2 +- nixos/home-manager/programs/emacs/home.nix | 2 +- nixos/home-other-os.nix | 2 +- nixos/i3/autorandr.nix | 2 +- nixos/tailscale.nix | 3 +-- shell.nix | 27 ++++++++++--------- 16 files changed, 32 insertions(+), 36 deletions(-) diff --git a/.build.yml b/.build.yml index b21c4727..a3d131db 100644 --- a/.build.yml +++ b/.build.yml @@ -8,7 +8,8 @@ secrets: tasks: - check: | cd dotfiles - nix-shell --pure --run 'nix-experimental flake info' + nix-shell --pure --run 'nix --extra-experimental-features "flakes nix-command" flake info' + nix-shell --pure --run 'statix check' - github_push: | set +xv diff --git a/flake.nix b/flake.nix index f01c68c3..f09d45b3 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ let mkServer = pkgs: system: hostname: pkgs.lib.nixosSystem { - system = system; + inherit system; modules = [ (./. + "/nixos/boxes/${hostname}") agenix.nixosModules.age @@ -23,7 +23,7 @@ }; mkWorkstation = pkgs: system: hostname: pkgs.lib.nixosSystem { - system = system; + inherit system; modules = [ (./. + "/nixos/boxes/${hostname}") (import ./nixos/email-accounts.nix) @@ -56,6 +56,7 @@ with nixpkgs-nixos-unstable.legacyPackages."x86_64-linux"; [ cacert git + nixFlakes nixpkgs-fmt openssh openssl diff --git a/nixos/boxes/bolty/tailscale-bolty.nix b/nixos/boxes/bolty/tailscale-bolty.nix index 0e86ae29..5046079e 100644 --- a/nixos/boxes/bolty/tailscale-bolty.nix +++ b/nixos/boxes/bolty/tailscale-bolty.nix @@ -1,7 +1,6 @@ { config, pkgs, inputs, lib, ... }: let - tailscale = - inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux".tailscale; + inherit (inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux") tailscale; in { systemd.services.tailscale-autoconnect = { description = "Automatic connection to Tailscale"; diff --git a/nixos/boxes/foureighty/tailscale-foureighty.nix b/nixos/boxes/foureighty/tailscale-foureighty.nix index 87df1d2f..dbbfa316 100644 --- a/nixos/boxes/foureighty/tailscale-foureighty.nix +++ b/nixos/boxes/foureighty/tailscale-foureighty.nix @@ -1,7 +1,6 @@ { config, pkgs, inputs, lib, ... }: let - tailscale = - inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux".tailscale; + inherit (inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux") tailscale; in { systemd.services.tailscale-autoconnect = { description = "Automatic connection to Tailscale"; diff --git a/nixos/boxes/skinnyv/tailscale-skinnyv.nix b/nixos/boxes/skinnyv/tailscale-skinnyv.nix index 8f10fc80..609e0161 100644 --- a/nixos/boxes/skinnyv/tailscale-skinnyv.nix +++ b/nixos/boxes/skinnyv/tailscale-skinnyv.nix @@ -1,7 +1,6 @@ { config, pkgs, inputs, lib, ... }: let - tailscale = - inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux".tailscale; + inherit (inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux") tailscale; in { systemd.services.tailscale-autoconnect = { description = "Automatic connection to Tailscale"; diff --git a/nixos/boxes/thinky/tailscale-thinky.nix b/nixos/boxes/thinky/tailscale-thinky.nix index 4478d96f..3193eb5b 100644 --- a/nixos/boxes/thinky/tailscale-thinky.nix +++ b/nixos/boxes/thinky/tailscale-thinky.nix @@ -1,7 +1,6 @@ { config, pkgs, inputs, lib, ... }: let - tailscale = - inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux".tailscale; + inherit (inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux") tailscale; in { systemd.services.tailscale-autoconnect = { description = "Automatic connection to Tailscale"; diff --git a/nixos/boxes/vpsfree1/tailscale-vpsfree1.nix b/nixos/boxes/vpsfree1/tailscale-vpsfree1.nix index a95570b6..8cd3f48f 100644 --- a/nixos/boxes/vpsfree1/tailscale-vpsfree1.nix +++ b/nixos/boxes/vpsfree1/tailscale-vpsfree1.nix @@ -1,7 +1,6 @@ { config, pkgs, inputs, lib, ... }: let - tailscale = - inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux".tailscale; + inherit (inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux") tailscale; in { systemd.services.tailscale-autoconnect = { description = "Automatic connection to Tailscale"; diff --git a/nixos/boxes/vultr1/tailscale-vultr1.nix b/nixos/boxes/vultr1/tailscale-vultr1.nix index 45e2ca70..c123ad91 100644 --- a/nixos/boxes/vultr1/tailscale-vultr1.nix +++ b/nixos/boxes/vultr1/tailscale-vultr1.nix @@ -1,7 +1,6 @@ { config, pkgs, inputs, lib, ... }: let - tailscale = - inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux".tailscale; + inherit (inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux") tailscale; in { systemd.services.tailscale-autoconnect = { description = "Automatic connection to Tailscale"; diff --git a/nixos/common-hardware.nix b/nixos/common-hardware.nix index 730e5b69..2510810a 100644 --- a/nixos/common-hardware.nix +++ b/nixos/common-hardware.nix @@ -96,7 +96,7 @@ }; powerManagement = { - enable = (lib.mkForce true); + enable = lib.mkForce true; resumeCommands = '' ${pkgs.autorandr}/bin/autorandr -c ''; diff --git a/nixos/email-accounts.nix b/nixos/email-accounts.nix index eaefd6cc..45e4a57f 100644 --- a/nixos/email-accounts.nix +++ b/nixos/email-accounts.nix @@ -1,7 +1,7 @@ { config, pkgs, inputs, ... }: let unstable = inputs.nixpkgs-nixos-unstable.legacyPackages.${pkgs.system}; in { - home-manager.users.cyryl = { ... }: { + home-manager.users.cyryl = { accounts.email.accounts.cyplo = { primary = true; address = "cyplo@cyplo.dev"; diff --git a/nixos/home-manager/programs/emacs/emacs.nix b/nixos/home-manager/programs/emacs/emacs.nix index 2d22902f..c6971efe 100644 --- a/nixos/home-manager/programs/emacs/emacs.nix +++ b/nixos/home-manager/programs/emacs/emacs.nix @@ -1,7 +1,7 @@ { pkgs }: let myEmacs = pkgs.emacs-nox; - emacsWithPackages = (pkgs.emacsPackagesGen myEmacs).emacsWithPackages; + inherit ((pkgs.emacsPackagesGen myEmacs)) emacsWithPackages; in emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [ magit solarized-theme evil ]) ++ (with epkgs.melpaPackages; [ xterm-color nix-mode ]) diff --git a/nixos/home-manager/programs/emacs/home.nix b/nixos/home-manager/programs/emacs/home.nix index 4a87cbec..48c4bee0 100644 --- a/nixos/home-manager/programs/emacs/home.nix +++ b/nixos/home-manager/programs/emacs/home.nix @@ -24,7 +24,7 @@ ''; programs.emacs = { enable = true; - package = (import ./emacs.nix { inherit pkgs; }); + package = import ./emacs.nix { inherit pkgs; }; }; } diff --git a/nixos/home-other-os.nix b/nixos/home-other-os.nix index 1188ab28..70cc6fe9 100644 --- a/nixos/home-other-os.nix +++ b/nixos/home-other-os.nix @@ -12,7 +12,7 @@ in { nixpkgs.config = { allowUnfree = true; packageOverrides = pkgs: { - unstable = import unstableTarball { config = config.nixpkgs.config; }; + unstable = import unstableTarball { inherit (config.nixpkgs) config; }; }; }; diff --git a/nixos/i3/autorandr.nix b/nixos/i3/autorandr.nix index a1d4d533..b563a63a 100644 --- a/nixos/i3/autorandr.nix +++ b/nixos/i3/autorandr.nix @@ -1,6 +1,6 @@ { config, pkgs, ... }: { services.autorandr.enable = true; - home-manager.users.cyryl = { ... }: { + home-manager.users.cyryl = _: { programs.autorandr = { enable = true; hooks.postswitch = { diff --git a/nixos/tailscale.nix b/nixos/tailscale.nix index d8ade1bb..48f5fade 100644 --- a/nixos/tailscale.nix +++ b/nixos/tailscale.nix @@ -1,7 +1,6 @@ { config, pkgs, inputs, ... }: let - tailscale = - inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux".tailscale; + inherit (inputs.nixpkgs-nixos-unstable.legacyPackages."x86_64-linux") tailscale; in { environment.systemPackages = [ tailscale ]; diff --git a/shell.nix b/shell.nix index 07b065d7..e7bdb49e 100644 --- a/shell.nix +++ b/shell.nix @@ -1,13 +1,14 @@ -let nixpkgs = import { }; -in with nixpkgs; -stdenv.mkDerivation { - name = "legacy_shell"; - buildInputs = [ - (pkgs.writeShellScriptBin "nix-experimental" '' - exec ${pkgs.nixUnstable}/bin/nix --experimental-features "nix-command flakes" "$@" - '') - cacert - git - ]; - shellHook = ""; -} +(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 +