feat(flake): Add pre-commit checks and fix a lot of small things

This commit is contained in:
Malte Tammena 2023-04-19 02:10:55 +02:00
parent d7d8102393
commit d1e885e089
36 changed files with 151 additions and 87 deletions

View file

@ -704,6 +704,22 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_9": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
@ -924,6 +940,21 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_10": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": { "flake-utils_2": {
"locked": { "locked": {
"lastModified": 1642700792, "lastModified": 1642700792,
@ -1161,6 +1192,27 @@
"type": "github" "type": "github"
} }
}, },
"gitignore_4": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1660459072,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gomod2nix": { "gomod2nix": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -1748,6 +1800,22 @@
} }
}, },
"nixpkgs-stable_4": { "nixpkgs-stable_4": {
"locked": {
"lastModified": 1678872516,
"narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable_5": {
"locked": { "locked": {
"lastModified": 1681005198, "lastModified": 1681005198,
"narHash": "sha256-5LrnBeXR7Hv8OXh6eany7br4qBW+ZNl4LKf1CJu9zbg=", "narHash": "sha256-5LrnBeXR7Hv8OXh6eany7br4qBW+ZNl4LKf1CJu9zbg=",
@ -1956,6 +2024,22 @@
} }
}, },
"nixpkgs_17": { "nixpkgs_17": {
"locked": {
"lastModified": 1681303793,
"narHash": "sha256-JEdQHsYuCfRL2PICHlOiH/2ue3DwoxUX7DJ6zZxZXFk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "fe2ecaf706a5907b5e54d979fbde4924d84b65fc",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_18": {
"locked": { "locked": {
"lastModified": 1680945546, "lastModified": 1680945546,
"narHash": "sha256-8FuaH5t/aVi/pR1XxnF0qi4WwMYC+YxlfdsA0V+TEuQ=", "narHash": "sha256-8FuaH5t/aVi/pR1XxnF0qi4WwMYC+YxlfdsA0V+TEuQ=",
@ -1971,7 +2055,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_18": { "nixpkgs_19": {
"locked": { "locked": {
"lastModified": 1680945546, "lastModified": 1680945546,
"narHash": "sha256-8FuaH5t/aVi/pR1XxnF0qi4WwMYC+YxlfdsA0V+TEuQ=", "narHash": "sha256-8FuaH5t/aVi/pR1XxnF0qi4WwMYC+YxlfdsA0V+TEuQ=",
@ -2257,6 +2341,28 @@
"type": "github" "type": "github"
} }
}, },
"pre-commit-hooks-nix_4": {
"inputs": {
"flake-compat": "flake-compat_9",
"flake-utils": "flake-utils_10",
"gitignore": "gitignore_4",
"nixpkgs": "nixpkgs_17",
"nixpkgs-stable": "nixpkgs-stable_4"
},
"locked": {
"lastModified": 1681831107,
"narHash": "sha256-pXl3DPhhul9NztSetUJw2fcN+RI3sGOYgKu29xpgnqw=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "b7ca8f6fff42f6af75c17f9438fed1686b7d855d",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"pre-commit-hooks_2": { "pre-commit-hooks_2": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
@ -2432,6 +2538,7 @@
"nixpkgs": "nixpkgs_14", "nixpkgs": "nixpkgs_14",
"nixpkgs-wayland": "nixpkgs-wayland", "nixpkgs-wayland": "nixpkgs-wayland",
"nixpkgsForNixForHydra": "nixpkgsForNixForHydra", "nixpkgsForNixForHydra": "nixpkgsForNixForHydra",
"pre-commit-hooks-nix": "pre-commit-hooks-nix_4",
"qmk-udev-rules": "qmk-udev-rules", "qmk-udev-rules": "qmk-udev-rules",
"radicale_infcloud": "radicale_infcloud", "radicale_infcloud": "radicale_infcloud",
"rip": "rip", "rip": "rip",
@ -2462,7 +2569,7 @@
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"nixpkgs-stable": "nixpkgs-stable_4" "nixpkgs-stable": "nixpkgs-stable_5"
}, },
"locked": { "locked": {
"lastModified": 1681209176, "lastModified": 1681209176,
@ -2565,7 +2672,7 @@
}, },
"treefmt-nix_4": { "treefmt-nix_4": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_17" "nixpkgs": "nixpkgs_18"
}, },
"locked": { "locked": {
"lastModified": 1681486253, "lastModified": 1681486253,
@ -2617,7 +2724,7 @@
"xdg-desktop-portal-hyprland": { "xdg-desktop-portal-hyprland": {
"inputs": { "inputs": {
"hyprland-protocols": "hyprland-protocols_2", "hyprland-protocols": "hyprland-protocols_2",
"nixpkgs": "nixpkgs_18" "nixpkgs": "nixpkgs_19"
}, },
"locked": { "locked": {
"lastModified": 1681416853, "lastModified": 1681416853,

View file

@ -5,6 +5,7 @@
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
devshell.url = "github:numtide/devshell"; devshell.url = "github:numtide/devshell";
treefmt-nix.url = "github:numtide/treefmt-nix"; treefmt-nix.url = "github:numtide/treefmt-nix";
pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix";
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware"; nixos-hardware.url = "github:NixOS/nixos-hardware";
@ -99,7 +100,7 @@
inputs.fenix.overlays.default inputs.fenix.overlays.default
inputs.colmena.overlay inputs.colmena.overlay
inputs.xdg-desktop-portal-hyprland.overlays.default inputs.xdg-desktop-portal-hyprland.overlays.default
(self: super: { (_: super: {
# Add fonts # Add fonts
hackNerdLigatures = super.callPackage ./pkgs/hack.nix {}; hackNerdLigatures = super.callPackage ./pkgs/hack.nix {};
# Add the emulator # Add the emulator
@ -144,15 +145,13 @@
imports = [ imports = [
inputs.devshell.flakeModule inputs.devshell.flakeModule
inputs.treefmt-nix.flakeModule inputs.treefmt-nix.flakeModule
inputs.pre-commit-hooks-nix.flakeModule
]; ];
# Available systems, only x86 for now # Available systems, only x86 for now
systems = ["x86_64-linux"]; systems = ["x86_64-linux"];
perSystem = { perSystem = {
config,
self',
inputs',
pkgs, pkgs,
system, self',
... ...
}: { }: {
# Configure treefmt # Configure treefmt
@ -162,6 +161,11 @@
shellcheck.enable = true; shellcheck.enable = true;
shfmt.enable = true; shfmt.enable = true;
}; };
# Configure pre-commit checks
pre-commit.settings.hooks.deadnix.enable = true;
pre-commit.settings.hooks.treefmt.enable = true;
pre-commit.settings.hooks.shellcheck.enable = true;
pre-commit.settings.hooks.markdownlint.enable = true;
# Load all packages from ./pkgs # Load all packages from ./pkgs
packages = let packages = let
pkgFiles = builtins.attrNames (builtins.readDir ./pkgs); pkgFiles = builtins.attrNames (builtins.readDir ./pkgs);
@ -176,6 +180,7 @@
name = "dev"; name = "dev";
packages = [ packages = [
pkgs.nil pkgs.nil
pkgs.pre-commit
self'.packages.rebuild self'.packages.rebuild
self'.packages.personal-cache self'.packages.personal-cache
self'.packages.all-hosts self'.packages.all-hosts

View file

@ -1,7 +1,5 @@
{ {
config,
lib, lib,
pkgs,
modulesPath, modulesPath,
... ...
}: { }: {

View file

@ -1,10 +1,4 @@
{ {modulesPath, ...}: let
config,
lib,
pkgs,
modulesPath,
...
}: let
cryptRoot.encrypted = { cryptRoot.encrypted = {
enable = true; enable = true;
blkDev = "/dev/disk/by-id/nvme-Samsung_SSD_960_PRO_512GB_S3EWNCAJ110156V-part3"; blkDev = "/dev/disk/by-id/nvme-Samsung_SSD_960_PRO_512GB_S3EWNCAJ110156V-part3";

View file

@ -1,5 +1,4 @@
{ {
config,
lib, lib,
pkgs, pkgs,
modulesPath, modulesPath,

View file

@ -1,7 +1,6 @@
{ {
config, config,
lib, lib,
pkgs,
modulesPath, modulesPath,
... ...
}: { }: {

View file

@ -1,10 +1,4 @@
{ {modulesPath, ...}: {
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [(modulesPath + "/profiles/qemu-guest.nix")]; imports = [(modulesPath + "/profiles/qemu-guest.nix")];
boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"]; boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"];

View file

@ -1,7 +1,6 @@
{ {
config, config,
lib, lib,
pkgs,
modulesPath, modulesPath,
... ...
}: { }: {

View file

@ -1,10 +1,4 @@
{ {modulesPath, ...}: {
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [(modulesPath + "/profiles/qemu-guest.nix")]; imports = [(modulesPath + "/profiles/qemu-guest.nix")];
boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"]; boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"];

View file

@ -4,7 +4,6 @@
{ {
config, config,
lib, lib,
pkgs,
modulesPath, modulesPath,
... ...
}: { }: {

View file

@ -2,7 +2,6 @@
config, config,
lib, lib,
pkgs, pkgs,
modulesPath,
... ...
}: { }: {
boot = { boot = {

View file

@ -1,5 +1,4 @@
{ {
pkgs,
lib, lib,
config, config,
... ...

View file

@ -42,7 +42,7 @@ in {
# Allow joypixels' license and unfree licenses in general # Allow joypixels' license and unfree licenses in general
nixpkgs.config = { nixpkgs.config = {
# TODO: Fix once allowUnfree works for home-manager again # TODO: Fix once allowUnfree works for home-manager again
allowUnfreePredicate = pkg: true; allowUnfreePredicate = _: true;
joypixels.acceptLicense = true; joypixels.acceptLicense = true;
}; };
# This includes the firmware, oc # This includes the firmware, oc

View file

@ -1,4 +1,4 @@
{pkgs, ...}: { _: {
security.acme.defaults.email = "malte.tammena@pm.me"; security.acme.defaults.email = "malte.tammena@pm.me";
security.acme.acceptTerms = true; security.acme.acceptTerms = true;

View file

@ -1,6 +1,5 @@
{ {
config, config,
pkgs,
lib, lib,
... ...
}: let }: let

View file

@ -1,5 +1,4 @@
{ {
pkgs,
lib, lib,
config, config,
... ...

View file

@ -1,5 +1,4 @@
{ {
pkgs,
lib, lib,
config, config,
... ...

View file

@ -1,4 +1,4 @@
self: super: let _self: super: let
lock = builtins.fromJSON (builtins.readFile ../flake.lock); lock = builtins.fromJSON (builtins.readFile ../flake.lock);
in { in {
cataclysm-dda-git = cataclysm-dda-git =
@ -8,5 +8,5 @@ in {
inherit (lock.nodes.cataclysm-dda.locked) rev; inherit (lock.nodes.cataclysm-dda.locked) rev;
sha256 = lock.nodes.cataclysm-dda.locked.narHash; sha256 = lock.nodes.cataclysm-dda.locked.narHash;
}) })
.overrideAttrs (old: {enableParallelBuilding = true;}); .overrideAttrs (_old: {enableParallelBuilding = true;});
} }

View file

@ -1,6 +1,6 @@
self: super: { _self: super: {
kakounePlugins = super.lib.recursiveUpdate super.kakounePlugins { kakounePlugins = super.lib.recursiveUpdate super.kakounePlugins {
fzf-kak = super.kakounePlugins.fzf-kak.overrideAttrs (old: { fzf-kak = super.kakounePlugins.fzf-kak.overrideAttrs (_old: {
version = "95b12b1fe93c6db0441c61062823231a28eed037"; version = "95b12b1fe93c6db0441c61062823231a28eed037";
src = super.fetchFromGitHub { src = super.fetchFromGitHub {
owner = "andreyorst"; owner = "andreyorst";

View file

@ -1,7 +1,7 @@
self: super: let _self: super: let
font-flags = "-Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true"; font-flags = "-Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true";
in { in {
logisim = super.logisim.overrideAttrs (old: { logisim = super.logisim.overrideAttrs (_old: {
pname = "logisim-evolution"; pname = "logisim-evolution";
src = super.fetchurl { src = super.fetchurl {
url = "https://mathcs.holycross.edu/~kwalsh/logisim-evolution-4.0.4hc.jar"; url = "https://mathcs.holycross.edu/~kwalsh/logisim-evolution-4.0.4hc.jar";

View file

@ -1,4 +1,4 @@
self: super: { _self: super: {
prometheus-fritzbox-exporter = super.buildGoModule { prometheus-fritzbox-exporter = super.buildGoModule {
pname = "fritzbox-exporter"; pname = "fritzbox-exporter";
version = "git-6b8ced0"; version = "git-6b8ced0";

View file

@ -1,7 +1,7 @@
self: super: let _self: super: let
lock = builtins.fromJSON (builtins.readFile ../flake.lock); lock = builtins.fromJSON (builtins.readFile ../flake.lock);
in { in {
qmk-udev-rules = super.qmk-udev-rules.overrideAttrs (old: { qmk-udev-rules = super.qmk-udev-rules.overrideAttrs (_old: {
version = lock.nodes.qmk-udev-rules.locked.rev; version = lock.nodes.qmk-udev-rules.locked.rev;
src = super.fetchFromGitHub { src = super.fetchFromGitHub {
inherit (lock.nodes.qmk-udev-rules.locked) owner repo rev; inherit (lock.nodes.qmk-udev-rules.locked) owner repo rev;

View file

@ -1,4 +1,4 @@
self: super: { _self: super: {
waybar-hypr = super.waybar.overrideAttrs (old: { waybar-hypr = super.waybar.overrideAttrs (old: {
pname = "waybar-hypr"; pname = "waybar-hypr";
patchPhase = '' patchPhase = ''

View file

@ -1,13 +1,12 @@
{ {
lib, lib,
stdenv,
rustPlatform, rustPlatform,
fetchFromGitHub, fetchFromGitHub,
pkg-config, pkg-config,
}: let }: let
lock = builtins.fromJSON (builtins.readFile ../flake.lock); lock = builtins.fromJSON (builtins.readFile ../flake.lock);
in in
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage {
pname = "rip"; pname = "rip";
version = ""; version = "";
@ -24,6 +23,6 @@ in
description = "A safe and ergonomic alternative to rm"; description = "A safe and ergonomic alternative to rm";
homepage = "https://github.com/nivekuil/rip"; homepage = "https://github.com/nivekuil/rip";
license = with licenses; [gpl3]; license = with licenses; [gpl3];
maintainers = with maintainers; []; maintainers = [];
}; };
} }

View file

@ -1,5 +1,6 @@
# Node Exporter # Node Exporter
Please checkout the original repository! Please checkout the original repository!
Source: https://github.com/rfrail3/grafana-dashboards/tree/master/prometheus Source: [github:rfrail3/grafana-dashboards](https://github.com/rfrail3/grafana-dashboards/tree/master/prometheus)
License: Apache License: Apache

View file

@ -1,4 +1,4 @@
{pkgs, ...}: { _: {
programs.broot = { programs.broot = {
enable = true; enable = true;
enableFishIntegration = true; enableFishIntegration = true;

View file

@ -18,14 +18,15 @@
# === Font === # === Font ===
# FIXME: until https://github.com/NixOS/nixpkgs/issues/185633 is fixed # FIXME: until https://github.com/NixOS/nixpkgs/issues/185633 is fixed
iosevka = inherit
(import (pkgs.fetchFromGitHub { (import (pkgs.fetchFromGitHub {
owner = "NixOS"; owner = "NixOS";
repo = "nixpkgs"; repo = "nixpkgs";
rev = "0d440c18119406feb8a32cd5ec2ff0b83fc9104b"; rev = "0d440c18119406feb8a32cd5ec2ff0b83fc9104b";
sha256 = "sha256-Fw6zRNBonu9wwVSQ0Cj9zHliw6yChMQPf3GPQFJZ4us="; sha256 = "sha256-Fw6zRNBonu9wwVSQ0Cj9zHliw6yChMQPf3GPQFJZ4us=";
}) {system = "x86_64-linux";}) }) {system = "x86_64-linux";})
.iosevka; iosevka
;
fontSingleton = lib.singleton "${iosevka}/share/fonts/truetype/iosevka-bold.ttf"; fontSingleton = lib.singleton "${iosevka}/share/fonts/truetype/iosevka-bold.ttf";
fontsConfigPath = "${configDir}/fonts.json"; fontsConfigPath = "${configDir}/fonts.json";
fontsConfig = jsonConfig.generate "fonts.json" { fontsConfig = jsonConfig.generate "fonts.json" {

View file

@ -1,8 +1,4 @@
{ {pkgs, ...}: let
pkgs,
lib,
...
}: let
conf = import ./conf.nix; conf = import ./conf.nix;
configDir = "~/.config/git"; configDir = "~/.config/git";
deltaConfig = "${configDir}/delta"; deltaConfig = "${configDir}/delta";

View file

@ -1,8 +1,4 @@
{ {pkgs, ...}: let
pkgs,
lib,
...
}: let
notify = profile: [ notify = profile: [
"${pkgs.libnotify}/bin/notify-send -t 10000 -a 'Kanshi' '${profile}' 'Profile activated'" "${pkgs.libnotify}/bin/notify-send -t 10000 -a 'Kanshi' '${profile}' 'Profile activated'"
]; ];

View file

@ -1,9 +1,4 @@
{ {pkgs, ...}: let
pkgs,
lib,
config,
...
}: let
darkTheme = pkgs.writeTextFile { darkTheme = pkgs.writeTextFile {
name = "kitty-dark"; name = "kitty-dark";
text = builtins.readFile ./gruvbox_dark.conf; text = builtins.readFile ./gruvbox_dark.conf;

View file

@ -1,4 +1,4 @@
{pkgs, ...}: { _: {
qt = { qt = {
enable = true; enable = true;
platformTheme = "gtk"; platformTheme = "gtk";

View file

@ -1,8 +1,4 @@
{ {pkgs, ...}: {
pkgs,
lib,
...
}: {
home.packages = with pkgs; [ home.packages = with pkgs; [
(pkgs.callPackage ../../pkgs/rip.nix {}) (pkgs.callPackage ../../pkgs/rip.nix {})
bottom bottom

View file

@ -1,6 +1,5 @@
{ {
pkgs, pkgs,
lib,
config, config,
... ...
}: let }: let

View file

@ -1,8 +1,6 @@
{ {
pkgs, pkgs,
lib, lib,
config,
nix-colors,
... ...
}: let }: let
# Create a color from a hexadezimal 6 digit description, like 'FF0000' for pure red # Create a color from a hexadezimal 6 digit description, like 'FF0000' for pure red

View file

@ -6,7 +6,7 @@
}: let }: let
cfg = config.services.darkman; cfg = config.services.darkman;
hasInitScript = name: conf: (builtins.hasAttr "initialize" conf) && (conf.initialize != null); hasInitScript = _name: conf: (builtins.hasAttr "initialize" conf) && (conf.initialize != null);
mkActivationEntry = name: conf: { mkActivationEntry = name: conf: {
name = "darkman-initialize-${name}"; name = "darkman-initialize-${name}";
value = lib.hm.dag.entryAfter ["writeBoundary"] '' value = lib.hm.dag.entryAfter ["writeBoundary"] ''

View file

@ -71,7 +71,7 @@ in {
CacheDirectory = "restic-backups-to-faunus-ater"; CacheDirectory = "restic-backups-to-faunus-ater";
CacheDirectoryMode = "0700"; CacheDirectoryMode = "0700";
# Convert the above map of environment variables into a list # Convert the above map of environment variables into a list
# of "KEY=VALUE" entrie # of "KEY=VALUE" entries
Environment = Environment =
builtins.attrValues builtins.attrValues
(builtins.mapAttrs (k: v: "${k}=${v}") sessionVars); (builtins.mapAttrs (k: v: "${k}=${v}") sessionVars);