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"
}
},
"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": {
"inputs": {
"nixpkgs-lib": [
@ -924,6 +940,21 @@
"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": {
"locked": {
"lastModified": 1642700792,
@ -1161,6 +1192,27 @@
"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": {
"flake": false,
"locked": {
@ -1748,6 +1800,22 @@
}
},
"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": {
"lastModified": 1681005198,
"narHash": "sha256-5LrnBeXR7Hv8OXh6eany7br4qBW+ZNl4LKf1CJu9zbg=",
@ -1956,6 +2024,22 @@
}
},
"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": {
"lastModified": 1680945546,
"narHash": "sha256-8FuaH5t/aVi/pR1XxnF0qi4WwMYC+YxlfdsA0V+TEuQ=",
@ -1971,7 +2055,7 @@
"type": "github"
}
},
"nixpkgs_18": {
"nixpkgs_19": {
"locked": {
"lastModified": 1680945546,
"narHash": "sha256-8FuaH5t/aVi/pR1XxnF0qi4WwMYC+YxlfdsA0V+TEuQ=",
@ -2257,6 +2341,28 @@
"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": {
"inputs": {
"flake-utils": [
@ -2432,6 +2538,7 @@
"nixpkgs": "nixpkgs_14",
"nixpkgs-wayland": "nixpkgs-wayland",
"nixpkgsForNixForHydra": "nixpkgsForNixForHydra",
"pre-commit-hooks-nix": "pre-commit-hooks-nix_4",
"qmk-udev-rules": "qmk-udev-rules",
"radicale_infcloud": "radicale_infcloud",
"rip": "rip",
@ -2462,7 +2569,7 @@
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_4"
"nixpkgs-stable": "nixpkgs-stable_5"
},
"locked": {
"lastModified": 1681209176,
@ -2565,7 +2672,7 @@
},
"treefmt-nix_4": {
"inputs": {
"nixpkgs": "nixpkgs_17"
"nixpkgs": "nixpkgs_18"
},
"locked": {
"lastModified": 1681486253,
@ -2617,7 +2724,7 @@
"xdg-desktop-portal-hyprland": {
"inputs": {
"hyprland-protocols": "hyprland-protocols_2",
"nixpkgs": "nixpkgs_18"
"nixpkgs": "nixpkgs_19"
},
"locked": {
"lastModified": 1681416853,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
self: super: let
_self: super: let
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
in {
cataclysm-dda-git =
@ -8,5 +8,5 @@ in {
inherit (lock.nodes.cataclysm-dda.locked) rev;
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 {
fzf-kak = super.kakounePlugins.fzf-kak.overrideAttrs (old: {
fzf-kak = super.kakounePlugins.fzf-kak.overrideAttrs (_old: {
version = "95b12b1fe93c6db0441c61062823231a28eed037";
src = super.fetchFromGitHub {
owner = "andreyorst";

View file

@ -1,7 +1,7 @@
self: super: let
_self: super: let
font-flags = "-Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true";
in {
logisim = super.logisim.overrideAttrs (old: {
logisim = super.logisim.overrideAttrs (_old: {
pname = "logisim-evolution";
src = super.fetchurl {
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 {
pname = "fritzbox-exporter";
version = "git-6b8ced0";

View file

@ -1,7 +1,7 @@
self: super: let
_self: super: let
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
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;
src = super.fetchFromGitHub {
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: {
pname = "waybar-hypr";
patchPhase = ''

View file

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

View file

@ -1,5 +1,6 @@
# Node Exporter
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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6,7 +6,7 @@
}: let
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: {
name = "darkman-initialize-${name}";
value = lib.hm.dag.entryAfter ["writeBoundary"] ''

View file

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