chore: run alejandra

This commit is contained in:
Primrose 2025-06-20 21:41:16 +02:00
parent c509d80b58
commit 79ee2b4908
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
9 changed files with 169 additions and 147 deletions

View file

@ -1,7 +1,4 @@
{ {lib, ...}: {
lib,
...
}: {
imports = [ imports = [
../../nixosModules/extra/macbook-swap-fn-ctrl.nix ../../nixosModules/extra/macbook-swap-fn-ctrl.nix
../../configurations/tungsten/nixos/hardware-configuration.nix ../../configurations/tungsten/nixos/hardware-configuration.nix

View file

@ -28,7 +28,6 @@
pkgs.last-resort pkgs.last-resort
]; ];
home.file = { home.file = {
".xscreensaver".source = "${./xscreensaver/.xscreensaver}"; ".xscreensaver".source = "${./xscreensaver/.xscreensaver}";
}; };

View file

@ -1,7 +1,4 @@
{ {lib, ...}: {
lib,
...
}: {
imports = [ imports = [
# #
# Docker # Docker

View file

@ -10,7 +10,8 @@ let
infuse = lib.flip infuse-lib.v1.infuse; infuse = lib.flip infuse-lib.v1.infuse;
in in
# Why shouldn't I go crazy with overlays? # Why shouldn't I go crazy with overlays?
(final: infuse { (final:
infuse {
cmus.__input.alsaSupport = _: false; cmus.__input.alsaSupport = _: false;
fish.__input.usePython = _: false; fish.__input.usePython = _: false;

View file

@ -14,19 +14,28 @@ in
hlib = pkgs.haskell.lib; hlib = pkgs.haskell.lib;
callHackage = {name, version}: callHackage = {
let pkg = pkgs.haskell.packages.ghc910.callHackage name version {}; name,
in hlib.dontCheck (hlib.doJailbreak pkg); version,
}: let
pkg = pkgs.haskell.packages.ghc910.callHackage name version {};
in
hlib.dontCheck (hlib.doJailbreak pkg);
in { in {
name = "flora"; name = "flora";
packages = with pkgs; packages = with pkgs; let
let
haskellPackages = haskell.packages.ghc910; haskellPackages = haskell.packages.ghc910;
in in
# These don't build directly and need to be pinned # These don't build directly and need to be pinned
map callHackage [ map callHackage [
{name = "fourmolu"; version = "0.17.0.0";} {
{name = "postgresql-migration"; version = "0.2.1.8";} name = "fourmolu";
version = "0.17.0.0";
}
{
name = "postgresql-migration";
version = "0.2.1.8";
}
] ]
++ [ ++ [
haskellPackages.ghcid haskellPackages.ghcid

View file

@ -1,7 +1,10 @@
{config, lib, ...}: let
cfg = config.programs.lazygit;
in
{ {
config,
lib,
...
}: let
cfg = config.programs.lazygit;
in {
programs.tmux.extraConfig = lib.mkIf cfg.enable '' programs.tmux.extraConfig = lib.mkIf cfg.enable ''
bind -n C-g run-shell "tmux new-window ${lib.getExe cfg.package}" bind -n C-g run-shell "tmux new-window ${lib.getExe cfg.package}"
''; '';

View file

@ -1,4 +1,9 @@
{pkgs, lib, config, ...}: let {
pkgs,
lib,
config,
...
}: let
cfg = config.programs.neovim; cfg = config.programs.neovim;
in { in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {

View file

@ -1,11 +1,17 @@
# This module integrates tmux with fish # This module integrates tmux with fish
{pkgs, lib, config, ...}: { {
pkgs,
lib,
config,
...
}: {
assertions = [ assertions = [
{ assertion = config.programs.fish.enable; {
assertion = config.programs.fish.enable;
message = "Should have fish enabled"; message = "Should have fish enabled";
} }
{ assertion = config.programs.tmux.enable; {
assertion = config.programs.tmux.enable;
message = "Should have tmux enabled"; message = "Should have tmux enabled";
} }
]; ];
@ -26,5 +32,4 @@
home.packages = with pkgs; [ home.packages = with pkgs; [
tmux-sessionizer tmux-sessionizer
]; ];
} }

View file

@ -13,8 +13,10 @@ let
version = data.version; version = data.version;
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = range = first: last:
first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1); if first > last
then []
else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
@ -27,47 +29,44 @@ let
# If the environment variable NPINS_OVERRIDE_${name} is set, then use # If the environment variable NPINS_OVERRIDE_${name} is set, then use
# the path directly as opposed to the fetched source. # the path directly as opposed to the fetched source.
# (Taken from Niv for compatibility) # (Taken from Niv for compatibility)
mayOverride = mayOverride = name: path: let
name: path:
let
envVarName = "NPINS_OVERRIDE_${saneName}"; envVarName = "NPINS_OVERRIDE_${saneName}";
saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name; saneName = stringAsChars (c:
if (builtins.match "[a-zA-Z0-9]" c) == null
then "_"
else c)
name;
ersatz = builtins.getEnv envVarName; ersatz = builtins.getEnv envVarName;
in in
if ersatz == "" then if ersatz == ""
path then path
else else
# this turns the string into an actual Nix path (for both absolute and # this turns the string into an actual Nix path (for both absolute and
# relative paths) # relative paths)
builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" ( builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" (
if builtins.substring 0 1 ersatz == "/" then if builtins.substring 0 1 ersatz == "/"
/. + ersatz then /. + ersatz
else else /. + builtins.getEnv "PWD" + "/${ersatz}"
/. + builtins.getEnv "PWD" + "/${ersatz}"
); );
mkSource = mkSource = name: spec:
name: spec: assert spec ? type; let
assert spec ? type;
let
path = path =
if spec.type == "Git" then if spec.type == "Git"
mkGitSource spec then mkGitSource spec
else if spec.type == "GitRelease" then else if spec.type == "GitRelease"
mkGitSource spec then mkGitSource spec
else if spec.type == "PyPi" then else if spec.type == "PyPi"
mkPyPiSource spec then mkPyPiSource spec
else if spec.type == "Channel" then else if spec.type == "Channel"
mkChannelSource spec then mkChannelSource spec
else if spec.type == "Tarball" then else if spec.type == "Tarball"
mkTarballSource spec then mkTarballSource spec
else else builtins.throw "Unknown source type ${spec.type}";
builtins.throw "Unknown source type ${spec.type}";
in in
spec // {outPath = mayOverride name path;}; spec // {outPath = mayOverride name path;};
mkGitSource = mkGitSource = {
{
repository, repository,
revision, revision,
url ? null, url ? null,
@ -79,32 +78,35 @@ let
assert repository ? type; assert repository ? type;
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
# In the latter case, there we will always be an url to the tarball # In the latter case, there we will always be an url to the tarball
if url != null && !submodules then if url != null && !submodules
then
builtins.fetchTarball { builtins.fetchTarball {
inherit url; inherit url;
sha256 = hash; # FIXME: check nix version & use SRI hashes sha256 = hash; # FIXME: check nix version & use SRI hashes
} }
else else let
let
url = url =
if repository.type == "Git" then if repository.type == "Git"
repository.url then repository.url
else if repository.type == "GitHub" then else if repository.type == "GitHub"
"https://github.com/${repository.owner}/${repository.repo}.git" then "https://github.com/${repository.owner}/${repository.repo}.git"
else if repository.type == "GitLab" then else if repository.type == "GitLab"
"${repository.server}/${repository.repo_path}.git" then "${repository.server}/${repository.repo_path}.git"
else else throw "Unrecognized repository type ${repository.type}";
throw "Unrecognized repository type ${repository.type}"; urlToName = url: rev: let
urlToName =
url: rev:
let
matched = builtins.match "^.*/([^/]*)(\\.git)?$" url; matched = builtins.match "^.*/([^/]*)(\\.git)?$" url;
short = builtins.substring 0 7 rev; short = builtins.substring 0 7 rev;
appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else ""; appendShort =
in if (builtins.match "[a-f0-9]*" rev) != null
"${if matched == null then "source" else builtins.head matched}${appendShort}"; then "-${short}"
else "";
in "${
if matched == null
then "source"
else builtins.head matched
}${appendShort}";
name = urlToName url revision; name = urlToName url revision;
in in
builtins.fetchGit { builtins.fetchGit {
@ -114,22 +116,27 @@ let
inherit url submodules; inherit url submodules;
}; };
mkPyPiSource = mkPyPiSource = {
{ url, hash, ... }: url,
hash,
...
}:
builtins.fetchurl { builtins.fetchurl {
inherit url; inherit url;
sha256 = hash; sha256 = hash;
}; };
mkChannelSource = mkChannelSource = {
{ url, hash, ... }: url,
hash,
...
}:
builtins.fetchTarball { builtins.fetchTarball {
inherit url; inherit url;
sha256 = hash; sha256 = hash;
}; };
mkTarballSource = mkTarballSource = {
{
url, url,
locked_url ? url, locked_url ? url,
hash, hash,
@ -140,7 +147,6 @@ let
sha256 = hash; sha256 = hash;
}; };
in in
if version == 5 then if version == 5
builtins.mapAttrs mkSource data.pins then builtins.mapAttrs mkSource data.pins
else else throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"