Skip to content

Commit

Permalink
Autoformat using RFC style nixfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
rake5k committed Nov 9, 2024
1 parent ea90087 commit 8f948d7
Show file tree
Hide file tree
Showing 112 changed files with 1,185 additions and 722 deletions.
84 changes: 43 additions & 41 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -90,37 +90,29 @@
};
};

outputs = { self, nixpkgs, ... } @ inputs:
outputs =
{ self, nixpkgs, ... }@inputs:
let
nixcfgLib = import ./lib {
inherit inputs;
};
nixcfgLib = import ./lib { inherit inputs; };
inherit (inputs.flake-utils.lib.system) aarch64-darwin aarch64-linux x86_64-linux;
inherit (nixpkgs.lib) listToAttrs recursiveUpdate;
in
with nixcfgLib;
{
name = "nixcfg";

lib = { inputs }:
import ./lib { inputs = inputs // self.inputs; };
lib = { inputs }: import ./lib { inputs = inputs // self.inputs; };

darwinConfigurations = listToAttrs [
(mkNixDarwin aarch64-darwin "macos")
];
darwinConfigurations = listToAttrs [ (mkNixDarwin aarch64-darwin "macos") ];

homeConfigurations = listToAttrs [
(mkHome x86_64-linux "christian@non-nixos")
(mkHome x86_64-linux "demo@non-nixos")
];

nixosConfigurations = listToAttrs [
(mkNixos x86_64-linux "nixos")
];
nixosConfigurations = listToAttrs [ (mkNixos x86_64-linux "nixos") ];

nixOnDroidConfigurations = listToAttrs [
(mkNixOnDroid aarch64-linux "nix-on-droid")
];
nixOnDroidConfigurations = listToAttrs [ (mkNixOnDroid aarch64-linux "nix-on-droid") ];

formatter = forEachSystem (system: nixpkgs.legacyPackages."${system}".nixfmt-rfc-style);

Expand All @@ -131,42 +123,52 @@
_doNotClearPath = true;
flakePath = "/home/\$(logname)/.nix-config";
};
path = pkgs: with pkgs; [
git
hostname
jq
];
path =
pkgs: with pkgs; [
git
hostname
jq
];
})

(mkApp "nixos-install" {
file = "nixos-install.sh";
envs = {
_doNotClearPath = true;
};
path = pkgs: with pkgs; [
git
hostname
util-linux
parted
cryptsetup
lvm2
];
path =
pkgs: with pkgs; [
git
hostname
util-linux
parted
cryptsetup
lvm2
];
})
];

checks = recursiveUpdate
(forEachSystem (system: import ./lib/checks { pkgs = pkgsFor."${system}"; flake = self; }))
((mkForSystem aarch64-darwin [
(mkBuild "build-macos" self.darwinConfigurations.macos.system)
]) // (mkForSystem x86_64-linux [
(mkBuild "build-christian@non-nixos" self.homeConfigurations."christian@non-nixos".activationPackage)
(mkBuild "build-demo@non-nixos" self.homeConfigurations."demo@non-nixos".activationPackage)
(mkBuild "build-nixos" self.nixosConfigurations.nixos.config.system.build.toplevel)
]));

devShells = mkForEachSystem [
(mkDevShell "default" { flake = self; })
];
checks =
recursiveUpdate
(forEachSystem (
system:
import ./lib/checks {
pkgs = pkgsFor."${system}";
flake = self;
}
))
(
(mkForSystem aarch64-darwin [ (mkBuild "build-macos" self.darwinConfigurations.macos.system) ])
// (mkForSystem x86_64-linux [
(mkBuild "build-christian@non-nixos"
self.homeConfigurations."christian@non-nixos".activationPackage
)
(mkBuild "build-demo@non-nixos" self.homeConfigurations."demo@non-nixos".activationPackage)
(mkBuild "build-nixos" self.nixosConfigurations.nixos.config.system.build.toplevel)
])
);

devShells = mkForEachSystem [ (mkDevShell "default" { flake = self; }) ];

# Necessary for nix-tree
# Run it using `nix-tree . --impure --derivation`
Expand Down
11 changes: 7 additions & 4 deletions home/base/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:

{
home = {
homeDirectory = lib.mkDefault "/home/${config.home.username}";

sessionPath = [
"$HOME/bin"
];
sessionPath = [ "$HOME/bin" ];

enableNixpkgsReleaseCheck = true;
};
Expand Down
4 changes: 1 addition & 3 deletions home/base/fonts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ with pkgs;
{
fonts.fontconfig.enable = true;

home.packages = [
corefonts
];
home.packages = [ corefonts ];
}
4 changes: 1 addition & 3 deletions home/base/nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{ pkgs, ... }:

{
home.packages = [
pkgs.nix-output-monitor
];
home.packages = [ pkgs.nix-output-monitor ];

# Command-not-found replacement
programs.nix-index.enable = true;
Expand Down
11 changes: 9 additions & 2 deletions home/base/non-nixos/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}:

let

Expand All @@ -14,7 +19,9 @@ in
custom.base.non-nixos = {
enable = lib.mkEnableOption "Config for non NixOS systems";

installNix = lib.mkEnableOption "Nix installation" // { default = true; };
installNix = lib.mkEnableOption "Nix installation" // {
default = true;
};
};
};

Expand Down
7 changes: 6 additions & 1 deletion home/base/non-nixos/home-manager/auto-upgrade/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:

with lib;

Expand Down
11 changes: 7 additions & 4 deletions home/base/non-nixos/home-manager/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}:

let

Expand All @@ -17,9 +22,7 @@ in
config = lib.mkIf cfg.enable {

home = {
packages = with pkgs; [
home-manager
];
packages = with pkgs; [ home-manager ];

shellAliases = {
hm-switch = "home-manager switch -b hm-bak --impure --flake '${flakeBaseDir}'";
Expand Down
7 changes: 6 additions & 1 deletion home/programs/abcde/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:

with lib;

Expand Down
40 changes: 28 additions & 12 deletions home/programs/davmail/default.nix
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:

with lib;

let

cfg = config.custom.programs.davmail;

configType = with types;
oneOf [ (attrsOf configType) str int bool ] // {
configType =
with types;
oneOf [
(attrsOf configType)
str
int
bool
]
// {
description = "davmail config type (str, int, bool or attribute set thereof)";
};

toStr = val: if isBool val then boolToString val else toString val;

linesForAttrs = attrs: concatMap
(name:
let value = attrs."${name}"; in
if isAttrs value
then map (line: name + "." + line) (linesForAttrs value)
else [ "${name}=${toStr value}" ]
)
(attrNames attrs);
linesForAttrs =
attrs:
concatMap (
name:
let
value = attrs."${name}";
in
if isAttrs value then
map (line: name + "." + line) (linesForAttrs value)
else
[ "${name}=${toStr value}" ]
) (attrNames attrs);

configFile = pkgs.writeText "davmail.properties" (concatStringsSep "\n" (linesForAttrs cfg.config));

Expand Down Expand Up @@ -106,4 +122,4 @@ in

home.packages = [ pkgs.davmail ];
};
}
}
75 changes: 50 additions & 25 deletions home/programs/firefox/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:

with lib;

Expand Down Expand Up @@ -156,44 +161,64 @@ in
default = "Harke Search";
engines = {
"${engines.harke}" = {
urls = [{
template = "https://search.harke.ch/search";
params = [
{ name = "q"; value = "{searchTerms}"; }
];
}];
urls = [
{
template = "https://search.harke.ch/search";
params = [
{
name = "q";
value = "{searchTerms}";
}
];
}
];
icon = ./icons/search.harke.ch.svg;
};

"${engines.nixPkgs}" = {
urls = [{
template = "https://search.nixos.org/packages";
params = [
{ name = "query"; value = "{searchTerms}"; }
];
}];
urls = [
{
template = "https://search.nixos.org/packages";
params = [
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@np" ];
};

"${engines.nixOpts}" = {
urls = [{
template = "https://search.nixos.org/options";
params = [
{ name = "query"; value = "{searchTerms}"; }
];
}];
urls = [
{
template = "https://search.nixos.org/options";
params = [
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@no" ];
};

"${engines.nixWiki}" = {
urls = [{
template = "https://nixos.wiki/index.php";
params = [
{ name = "search"; value = "{searchTerms}"; }
];
}];
urls = [
{
template = "https://nixos.wiki/index.php";
params = [
{
name = "search";
value = "{searchTerms}";
}
];
}
];
iconUpdateURL = "https://nixos.wiki/favicon.png";
updateInterval = 24 * 60 * 60 * 1000; # every day
definedAliases = [ "@nw" ];
Expand Down
Loading

0 comments on commit 8f948d7

Please sign in to comment.