1
0
Fork 0

statix hints

This commit is contained in:
Malte Brandy 2022-03-08 03:19:09 +01:00
parent 57123b08e1
commit ce0dc51535
39 changed files with 102 additions and 175 deletions

View file

@ -32,10 +32,10 @@ let
"zdf.de"
];
makeConfig = hostName: imports: {...}: {
makeConfig = hostName: imports: _: {
imports = imports ++ [./roles/default.nix];
m-0.hostName = hostName;
nixpkgs.overlays = [(_: _: (import ../channels.nix).${hostName})];
nixpkgs.overlays = [(_: _: (import ../channels.nix)."${hostName}")];
};
makeAutostart = name: {config, ...}: {
config.xdg.configFile."autostart/${name}.desktop".source = "${config.home.path}/share/applications/${name}.desktop";

View file

@ -205,7 +205,7 @@
systemd.user = {
startServices = true;
sessionVariables = config.home.sessionVariables;
inherit (config.home) sessionVariables;
};
services = {

View file

@ -5,13 +5,13 @@
}: let
simpleDesktopItem = name: command:
pkgs.makeDesktopItem {
name = name;
inherit name;
desktopName = name;
exec = command;
};
namedTerminalDesktopItem = name: command:
pkgs.makeDesktopItem {
name = name;
inherit name;
desktopName = name;
exec = command;
terminal = "true";

View file

@ -1,3 +1,3 @@
{...}: {
_: {
programs.git.signing.key = "6C3D12CD88CDF46C5EAF4D12226A2D41EF5378C9";
}

View file

@ -4,7 +4,7 @@
...
} @ args: let
hotkeys = import ./hotkeys.nix args;
mkTuple = lib.hm.gvariant.mkTuple;
inherit (lib.hm.gvariant) mkTuple;
statusScript = pkgs.writeHaskellScript
{
name = "status-script";

View file

@ -1,4 +1,4 @@
{...}: {
_: {
services = {
mpd = {
enable = true;

View file

@ -5,7 +5,7 @@
...
}: let
inherit (config.m-0) hostName;
modes = pkgs.lib.attrNames (import ../machines.nix).${hostName};
modes = pkgs.lib.attrNames (import ../machines.nix)."${hostName}";
modeFile = "${config.home.homeDirectory}/.mode";
modeDir = "${config.home.homeDirectory}/.volatile/modes";
configPath = "${config.home.homeDirectory}/git/config";

View file

@ -5,7 +5,7 @@
...
}:
with lib; let
dag = config.lib.dag;
inherit (config.lib) dag;
in {
home.activation.report-changes = dag.entryAnywhere ''
if [[ -n "$oldGenPath" && "$oldGenPath" != "$newGenPath" ]]; then

View file

@ -29,58 +29,4 @@ in {
};
};
};
programs.kitty = {
enable = true;
keybindings = {
"ctrl+plus" = "change_font_size all +1.0";
"ctrl+minus" = "change_font_size all -1.0";
};
settings = {
linux_display_server = "wayland"; # Causes ugly decorations
hide_window_decorations = true;
window_margin_width = 2;
strip_trailing_spaces = "always";
font_size = "10.5";
foreground = theme.primary.foreground;
background = theme.primary.background;
selection_foreground = theme.primary.background;
selection_background = theme.primary.foreground;
background_opacity = "0.9";
background_tint = "0.9";
# black
color0 = theme.normal.white;
color8 = theme.bright.white;
# red
color1 = theme.normal.red;
color9 = theme.bright.red;
# green
color2 = theme.normal.green;
color10 = theme.bright.green;
# yellow
color3 = theme.normal.yellow;
color11 = theme.bright.yellow;
# blue
color4 = theme.normal.blue;
color12 = theme.bright.blue;
# magenta
color5 = theme.normal.magenta;
color13 = theme.bright.magenta;
# cyan
color6 = theme.normal.cyan;
color14 = theme.bright.cyan;
color7 = theme.normal.black;
color15 = theme.bright.black;
};
};
}

View file

@ -1,4 +1,4 @@
{...}: {
_: {
dconf.settings = {
"org/gnome/desktop/screensaver" = {
lock-enabled = false;

View file

@ -1,4 +1,4 @@
{...}: {
_: {
dconf.settings = {
"org/gnome/desktop/screensaver" = {
lock-enabled = true;

View file

@ -10,7 +10,7 @@
(pkgs.formats.ini {}).generate "vdirsyncer-config" (
lib.mapAttrs
(
name: section: (lib.mapAttrs (name: option: builtins.toJSON option) section)
_: lib.mapAttrs (_: builtins.toJSON)
)
config
);

View file

@ -9,8 +9,8 @@ with lib; let
configure = {availablePlugins, ...}: {
plugins = builtins.attrValues (availablePlugins
// {
python = (availablePlugins.python.withPackages
(ps: [pkgs.weechatScripts.weechat-matrix]));
python = availablePlugins.python.withPackages
(ps: [pkgs.weechatScripts.weechat-matrix]);
});
scripts = [pkgs.weechatScripts.weechat-matrix];
};

View file

@ -13,6 +13,6 @@ in {
notes = [
"${config.home.homeDirectory}/git/notes" # add as many layers as you like
];
package = emanote.defaultPackage.${builtins.currentSystem};
package = emanote.defaultPackage."${builtins.currentSystem}";
};
}

View file

@ -2,9 +2,9 @@ let
sources = import ../nix/sources.nix;
inherit (import sources.nixos-unstable {}) lib pkgs;
modes = import ./machines.nix;
home-manager = channel: import "${sources.${channel}}/home-manager/home-manager.nix";
home-manager = channel: import "${sources."${channel}"}/home-manager/home-manager.nix";
buildHomeManager = host: mode:
(home-manager (import ../channels.nix).${host}.home-manager-channel {
(home-manager (import ../channels.nix)."${host}".home-manager-channel {
confPath = ../home.nix;
confAttr = "${host}-${mode}";
})

View file

@ -3,11 +3,12 @@ let
modes = import home-manager/machines.nix;
in
lib.listToAttrs (lib.flatten (lib.mapAttrsToList
(host: configs:
lib.mapAttrsToList
(mode: config: {
name = "${host}-${mode}";
value = config;
})
configs)
(
host:
lib.mapAttrsToList
(mode: config: {
name = "${host}-${mode}";
value = config;
})
)
modes))

View file

@ -117,7 +117,7 @@ let
# the path directly as opposed to the fetched source.
replace = name: drv: let
saneName = stringAsChars (c:
if isNull (builtins.match "[a-zA-Z0-9]" c)
if ((builtins.match "[a-zA-Z0-9]" c) == null)
then "_"
else c)
name;
@ -142,7 +142,7 @@ let
with builtins;
listToAttrs (map (attr: {
name = attr;
value = f attr set.${attr};
value = f attr set."${attr}";
}) (attrNames set))
);
@ -175,7 +175,7 @@ let
inherit (builtins) lessThan nixVersion fetchTarball;
in
if lessThan nixVersion "1.12"
then fetchTarball ({inherit url;} // (optionalAttrs (!isNull name) {inherit name;}))
then fetchTarball ({inherit url;} // (optionalAttrs (!(name == null)) {inherit name;}))
else fetchTarball attrs;
# fetchurl version that is compatible between all the versions of Nix
@ -187,7 +187,7 @@ let
inherit (builtins) lessThan nixVersion fetchurl;
in
if lessThan nixVersion "1.12"
then fetchurl ({inherit url;} // (optionalAttrs (!isNull name) {inherit name;}))
then fetchurl ({inherit url;} // (optionalAttrs (!(name == null)) {inherit name;}))
else fetchurl attrs;
# Create the final "sources" from the config
@ -210,7 +210,7 @@ let
then ./sources.json
else null,
sources ?
if isNull sourcesFile
if (sourcesFile == null)
then {}
else builtins.fromJSON (builtins.readFile sourcesFile),
system ? builtins.currentSystem,

View file

@ -6,7 +6,7 @@
}: let
wireguard = import ../../../common/wireguard.nix;
inherit (config.m-0) hosts prefix;
nixos-hardware = (import ../../../nix/sources.nix).nixos-hardware;
inherit ((import ../../../nix/sources.nix)) nixos-hardware;
inherit (import ../../../common/common.nix {inherit pkgs;}) syncthing;
vpn = (import ../../../private.nix).privateValue (_: _: {}) "vpn";
in {

View file

@ -89,7 +89,7 @@ in {
};
}
// lib.listToAttrs (map (name: {
name = name;
inherit name;
value = {serviceConfig.Type = "oneshot";};
})
backupJobNames);

View file

@ -6,8 +6,7 @@
}: let
wireguard = import ../../../common/wireguard.nix;
inherit (config.m-0) hosts prefix;
nixos-hardware = (import ../../../nix/sources.nix).nixos-hardware;
nixos-unstable = (import ../../../nix/sources.nix).nixos-unstable;
inherit (import ../../../nix/sources.nix) nixos-hardware nixos-unstable;
inherit (import ../../../common/common.nix {inherit pkgs;}) syncthing;
vpn = (import ../../../private.nix).privateValue (_: _: {}) "vpn";
in {

View file

@ -26,7 +26,7 @@ in {
allowedTCPPorts = ports;
allowedUDPPorts = ports;
};
security.acme.certs.${fqdn} = {
security.acme.certs."${fqdn}" = {
postRun = "systemctl restart coturn.service";
};
services = {

View file

@ -10,7 +10,7 @@
# For nixos-rebuild
nixpkgs.overlays =
[(_: _: (import ../../channels.nix).${config.networking.hostName})]
[(_: _: (import ../../channels.nix)."${config.networking.hostName}")]
++ import ../../overlays {inherit lib;};
time.timeZone = "Europe/Berlin";
@ -44,10 +44,10 @@
(name: value: lib.nameValuePair "nix-path/${name}" {source = value;})
(lib.filterAttrs (name: value: name != "__functor") pkgs.sources)
// {
"nix-path/nixos".source = pkgs.sources.${pkgs.nixpkgs-channel};
"nix-path/nixpkgs".source = pkgs.sources.${pkgs.nixpkgs-channel};
"nix-path/nixos".source = pkgs.sources."${pkgs.nixpkgs-channel}";
"nix-path/nixpkgs".source = pkgs.sources."${pkgs.nixpkgs-channel}";
"nix-path/home-manager".source =
pkgs.sources.${pkgs.home-manager-channel};
pkgs.sources."${pkgs.home-manager-channel}";
};
variables =
lib.genAttrs ["CURL_CA_BUNDLE" "GIT_SSL_CAINFO" "SSL_CERT_FILE"]
@ -112,7 +112,7 @@
disabledCollectors = ["timex"];
};
nginx = {
enable = config.services.nginx.enable;
inherit (config.services.nginx) enable;
openFirewall = true;
};
};

View file

@ -1,4 +1,4 @@
{...}: {
_: {
services.earlyoom = {
enableNotifications = true;
freeSwapThreshold = 100;

View file

@ -178,12 +178,12 @@ in {
'';
};
users.users.${user} = {
users.users."${user}" = {
inherit group;
isSystemUser = true;
};
users.groups.${group} = {};
users.groups."${group}" = {};
services = {
firefox.syncserver = {

View file

@ -39,7 +39,7 @@
builtins.listToAttrs (lib.imap0
(n: v:
lib.nameValuePair "src-cache/fonts/${toString n}" {
source = builtins.toPath v;
source = /. + v;
})
font_sources);
}

View file

@ -21,7 +21,7 @@
declarativeConfigFile = builtins.toFile "foundry-options.json" (builtins.toJSON config);
in {
config = {
systemd.services.${name} = {
systemd.services."${name}" = {
wantedBy = ["multi-user.target"];
description = "Foundryvtt server";
preStart = ''
@ -49,7 +49,7 @@ in {
services = {
nginx = {
virtualHosts = {
${config.hostname} = {
"${config.hostname}" = {
extraConfig = ''
client_max_body_size 300M;
proxy_set_header Host $host;

View file

@ -101,7 +101,7 @@ in {
];
users.users.cgit = {
isSystemUser = true;
group = gitoliteCfg.group;
inherit (gitoliteCfg) group;
};
systemd.services.gitolite-init.postStart = lib.mkIf pkgs.withSecrets ''
export GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no"
@ -133,7 +133,7 @@ in {
fcgiwrap = {
enable = true;
user = "cgit";
group = gitoliteCfg.group;
inherit (gitoliteCfg) group;
};
nginx.virtualHosts."git.maralorn.de" = {

View file

@ -5,7 +5,7 @@ lib: rec {
${default}
{% endif %}
'';
if' = condition: ifTrue: ifFalse: case ifFalse {${condition} = ifTrue;};
if' = condition: ifTrue: ifFalse: case ifFalse {"${condition}" = ifTrue;};
or = lhs: rhs: "(${lhs} or ${rhs})";
and = lhs: rhs: "(${lhs} and ${rhs})";
isState = entity: state: "is_state('${entity}','${state}')";

View file

@ -1,8 +1,8 @@
lib: let
# name refers to an internal name
# title refers to a human readable name
# mode = { name, title, options = { <option_name> : { title , icon } } }
in rec {
lib:
# name refers to an internal name
# title refers to a human readable name
# mode = { name, title, options = { <option_name> : { title , icon } } }
rec {
jinja = import ./jinja.nix lib;
tap_actions = let
fromServiceAction = action: {
@ -60,11 +60,11 @@ in rec {
mkHAConfig = attrs: {
services.home-assistant.config = attrs;
};
mkModeSwitcher = mode: attrs: {...}: let
mkModeSwitcher = mode: attrs: _: let
options = builtins.attrNames mode.options;
in
mkHAConfig {
input_select.${util.modeSelectName mode} =
input_select."${util.modeSelectName mode}" =
{
inherit options;
name = mode.title;

View file

@ -54,30 +54,26 @@
'';
systems = builtins.attrNames (builtins.readDir ../../machines);
homes = lib.attrNames (import ../../../home-manager/machines.nix);
mkHomeJob = (
host: {
name = "home-config-${host}.run";
value = pkgs.writeShellScript "test-${host}-home-config.run" ''
${common}
${checkout}
${test-home-config}/bin/test-home-config $REPODIR ${host} "remote"
git -C $REPODIR submodule update --init
${test-home-config}/bin/test-home-config $REPODIR ${host} ""
'';
}
);
mkSystemJob = (
host: {
name = "system-config-${host}.run";
value = pkgs.writeShellScript "test-${host}-system-config.run" ''
${common}
${checkout}
${test-system-config}/bin/test-system-config $REPODIR ${host} "remote"
git -C $REPODIR submodule update --init
${test-system-config}/bin/test-system-config $REPODIR ${host} ""
'';
}
);
mkHomeJob = host: {
name = "home-config-${host}.run";
value = pkgs.writeShellScript "test-${host}-home-config.run" ''
${common}
${checkout}
${test-home-config}/bin/test-home-config $REPODIR ${host} "remote"
git -C $REPODIR submodule update --init
${test-home-config}/bin/test-home-config $REPODIR ${host} ""
'';
};
mkSystemJob = host: {
name = "system-config-${host}.run";
value = pkgs.writeShellScript "test-${host}-system-config.run" ''
${common}
${checkout}
${test-system-config}/bin/test-system-config $REPODIR ${host} "remote"
git -C $REPODIR submodule update --init
${test-system-config}/bin/test-system-config $REPODIR ${host} ""
'';
};
deployCommand = "${
pkgs.writeShellScript "deploy-system-config"
"${pkgs.systemd}/bin/systemctl start --no-block update-config"

View file

@ -14,7 +14,7 @@ in {
(
x: ''
${cfg.package}/bin/mailman syncmembers -W -G - "${x}" << EOF
${lib.concatStringsSep "\n" lists.${x}}
${lib.concatStringsSep "\n" lists."${x}"}
EOF
''
)
@ -68,7 +68,7 @@ in {
local_recipient_maps = lmtp;
};
};
nginx.virtualHosts.${hostname} = {
nginx.virtualHosts."${hostname}" = {
enableACME = true;
forceSSL = true;
};

View file

@ -33,7 +33,7 @@
inherit
(import ../../../lib/update-system.nix {
inherit pkgs;
nixos-rebuild = config.system.build.nixos-rebuild;
inherit (config.system.build) nixos-rebuild;
})
update-system
;

View file

@ -6,9 +6,7 @@ in {
nix = self.nix_2_4;
unstableHaskellPackages = unstable.haskellPackages;
unstableGhc = unstable.ghc;
home-assistant = unstable.home-assistant;
vscode-extensions = unstable.vscode-extensions;
vscode = unstable.vscode;
inherit (unstable) home-assistant vscode-extensions vscode;
nix-output-monitor = unstable.nix-output-monitor.overrideAttrs (old: {
src = super.sources.nix-output-monitor;
buildInputs = old.buildInputs ++ (with unstable.haskellPackages; [streamly optics generic-optics extra safe MemoTrie]);

View file

@ -1,6 +0,0 @@
let
pkgs = import (import ../../nix/sources.nix).nixos-unstable {};
inherit (pkgs) lib;
myPkgs = (import ./packages.nix).makeHaskellPackages (pkgs.haskellPackages);
in
lib.attrNames (lib.filterAttrs (_: pkg: [] == pkg.meta.maintainers or []) myPkgs)

View file

@ -7,7 +7,7 @@ final: prev: let
["mkdir -p ${path}"]
++ lib.concatLists (
lib.mapAttrsToList
(dirName: content: linkToPath "${path}/${dirName}" content)
(dirName: linkToPath "${path}/${dirName}")
fileOrDir
)
);

View file

@ -35,9 +35,9 @@
// overrides
// {
pname = overrides.type;
version = source.version;
inherit (source) version;
patches = (source.patches or []);
patches = source.patches or [];
nativeBuildInputs =
[pkg-config python3 cmake]
++ (overrides.nativeBuildInputs or []);
@ -115,25 +115,23 @@
}
source;
server = source:
generic
{
type = "murmur";
server = generic
{
type = "murmur";
configureFlags = [
"CONFIG+=no-client"
];
configureFlags = [
"CONFIG+=no-client"
];
buildInputs =
[libcap]
++ lib.optionals grpcSupport [grpc which];
buildInputs =
[libcap]
++ lib.optionals grpcSupport [grpc which];
installPhase = ''
# bin stuff
install -Dm755 release/murmurd $out/bin/murmurd
'';
}
source;
installPhase = ''
# bin stuff
install -Dm755 release/murmurd $out/bin/murmurd
'';
};
source = rec {
version = "1.4.0-development-snapshot-005";

View file

@ -151,13 +151,8 @@ self: super: {
nodejs
tasksh
magic-wormhole
nixfmt
nixpkgs-fmt
rnix-lsp
tmate
rustup
foot
kitty
nix-top
ghcWithPackages
ghcid
@ -169,7 +164,7 @@ self: super: {
obelisk = (import self.sources.obelisk {}).command;
};
accounting-pkgs = {
inherit (self.haskellPackages) hledger hledger-ui hledger-web hledger-iadd;
inherit (self.haskellPackages) hledger hledger-ui hledger-web;
inherit (self) ledger jali aqbanking;
};
system-pkgs =
@ -177,7 +172,7 @@ self: super: {
// self.extra-system-pkgs
// {
home-manager =
self.callPackage "${self.sources.${self.home-manager-channel}}/home-manager" {};
self.callPackage "${self.sources."${self.home-manager-channel}"}/home-manager" {};
};
foreign-home-pkgs = self.extra-system-pkgs;
}

@ -1 +1 @@
Subproject commit 9782c148aedcc49620480983197fa54a16c29244
Subproject commit 80bc1996ca8e0d4b75183f6b76748806511fe6ec

View file

@ -6,8 +6,8 @@ in {
hooks = {
hlint.enable = true;
alejandra.enable = true;
#nix-linter.enable = true;
#statix.enable = true;
nix-linter.enable = true;
statix.enable = true;
fourmolu.enable = true;
cabal-fmt.enable = true;
shellcheck.enable = true;