add code formatter and reformat
This commit is contained in:
parent
a055f4fa40
commit
8cd6ed1502
69 changed files with 1016 additions and 797 deletions
127
outputs.nix
127
outputs.nix
|
@ -1,57 +1,62 @@
|
|||
# Adapted from Mic92/dotfiles
|
||||
{ self
|
||||
, flake-utils
|
||||
, homePage
|
||||
, nixpkgs
|
||||
, home-manager
|
||||
, nix-doom-emacs
|
||||
, nixos-hardware
|
||||
, nvd
|
||||
, scripts
|
||||
, recipemd
|
||||
, ...
|
||||
}@inputs:
|
||||
(flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
selfPkgs = self.packages.${system};
|
||||
in
|
||||
{
|
||||
apps.nixos-switch = {
|
||||
type = "app";
|
||||
program = toString (pkgs.writeScript "deploy" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
flake=$(nix flake metadata --json ${./.} | jq -r .url)
|
||||
nixos-rebuild switch --flake ".#$1" --use-remote-sudo
|
||||
'');
|
||||
};
|
||||
apps.deploy = {
|
||||
type = "app";
|
||||
program = toString (pkgs.writeScript "deploy" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
domain='dadada.li'
|
||||
flake=$(nix flake metadata --json ${./.} | jq -r .url)
|
||||
nixos-rebuild switch --upgrade --flake "''${flake}#$1" --target-host "''${1}.$domain" --build-host localhost --use-remote-sudo
|
||||
'');
|
||||
};
|
||||
apps.hm-switch = {
|
||||
type = "app";
|
||||
program = toString (pkgs.writeScript "hm-switch" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
set -eu -o pipefail -x
|
||||
tmpdir=$(mktemp -d)
|
||||
export PATH=${pkgs.lib.makeBinPath [ pkgs.coreutils pkgs.nixFlakes pkgs.jq ]}
|
||||
trap "rm -rf $tmpdir" EXIT
|
||||
declare -A profiles=(["gorgon"]="home")
|
||||
profile=''${profiles[$HOSTNAME]:-common}
|
||||
flake=$(nix flake metadata --json ${./.} | jq -r .url)
|
||||
nix build --out-link "$tmpdir/result" "$flake#hmConfigurations.''${profile}.activationPackage" "$@"
|
||||
link=$(realpath $tmpdir/result)
|
||||
$link/activate
|
||||
'');
|
||||
};
|
||||
devShell = pkgs.callPackage ./shell.nix { };
|
||||
})) // {
|
||||
{
|
||||
self,
|
||||
flake-utils,
|
||||
homePage,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
nix-doom-emacs,
|
||||
nixos-hardware,
|
||||
nvd,
|
||||
scripts,
|
||||
recipemd,
|
||||
...
|
||||
} @ inputs:
|
||||
(flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
selfPkgs = self.packages.${system};
|
||||
formatter = self.formatter.${system};
|
||||
in {
|
||||
apps.nixos-switch = {
|
||||
type = "app";
|
||||
program = toString (pkgs.writeScript "deploy" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
flake=$(nix flake metadata --json ${./.} | jq -r .url)
|
||||
nixos-rebuild switch --flake ".#$1" --use-remote-sudo
|
||||
'');
|
||||
};
|
||||
apps.deploy = {
|
||||
type = "app";
|
||||
program = toString (pkgs.writeScript "deploy" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
domain='dadada.li'
|
||||
flake=$(nix flake metadata --json ${./.} | jq -r .url)
|
||||
nixos-rebuild switch --upgrade --flake "''${flake}#$1" --target-host "''${1}.$domain" --build-host localhost --use-remote-sudo
|
||||
'');
|
||||
};
|
||||
apps.hm-switch = {
|
||||
type = "app";
|
||||
program = toString (pkgs.writeScript "hm-switch" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
set -eu -o pipefail -x
|
||||
tmpdir=$(mktemp -d)
|
||||
export PATH=${pkgs.lib.makeBinPath [pkgs.coreutils pkgs.nixFlakes pkgs.jq]}
|
||||
trap "rm -rf $tmpdir" EXIT
|
||||
declare -A profiles=(["gorgon"]="home")
|
||||
profile=''${profiles[$HOSTNAME]:-common}
|
||||
flake=$(nix flake metadata --json ${./.} | jq -r .url)
|
||||
nix build --out-link "$tmpdir/result" "$flake#hmConfigurations.''${profile}.activationPackage" "$@"
|
||||
link=$(realpath $tmpdir/result)
|
||||
$link/activate
|
||||
'');
|
||||
};
|
||||
devShell = pkgs.callPackage ./shell.nix {};
|
||||
formatter = nixpkgs.legacyPackages."${system}".alejandra;
|
||||
checks = {
|
||||
format = pkgs.runCommand "check-format" {buildInputs = [formatter];} "${formatter}/bin/alejandra -c ${./.} && touch $out";
|
||||
};
|
||||
}))
|
||||
// {
|
||||
hmConfigurations = import ./home/configurations.nix {
|
||||
inherit self nixpkgs home-manager;
|
||||
};
|
||||
|
@ -63,12 +68,16 @@
|
|||
};
|
||||
nixosModules = import ./nixos/modules inputs;
|
||||
overlays = import ./overlays;
|
||||
hydraJobs = (
|
||||
nixpkgs.lib.mapAttrs'
|
||||
hydraJobs =
|
||||
(
|
||||
nixpkgs.lib.mapAttrs'
|
||||
(name: config: nixpkgs.lib.nameValuePair name config.config.system.build.toplevel)
|
||||
self.nixosConfigurations
|
||||
) // (nixpkgs.lib.mapAttrs'
|
||||
(name: config: nixpkgs.lib.nameValuePair name config.activation-script)
|
||||
self.hmConfigurations
|
||||
) // (let tests = import ./tests; in flake-utils.lib.eachDefaultSystem tests);
|
||||
)
|
||||
// (
|
||||
nixpkgs.lib.mapAttrs'
|
||||
(name: config: nixpkgs.lib.nameValuePair name config.activation-script)
|
||||
self.hmConfigurations
|
||||
)
|
||||
// (let tests = import ./tests; in flake-utils.lib.eachDefaultSystem tests);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue