[treewide] reformat all files with nixfmt-rfc-style
This commit is contained in:
parent
3a31c21ae2
commit
2bdff39416
17 changed files with 653 additions and 531 deletions
186
flake.nix
186
flake.nix
|
@ -19,94 +19,118 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nur.url = "github:nix-community/NUR";
|
||||
nur.url = "github:nix-community/NUR";
|
||||
# TODO: possible make this a flake as well
|
||||
mysecrets = {
|
||||
flake = false;
|
||||
url = "git+ssh://gitea@git.orlives.de:2342/schmittlauch/home-manager_secrets.git";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs, nur, lanzaboote, utils, home-manager, treefmt-nix, ... }@inputs:
|
||||
let
|
||||
# FIXME: allow different systems
|
||||
systems = utils.lib.system;
|
||||
# necessary to make the top-level inputs available to system configuration
|
||||
# inspired by https://jade.fyi/blog/flakes-arent-real/
|
||||
inputInjection = {pkgs, lib, ...}: {
|
||||
options.inputInjection = lib.mkOption {
|
||||
type = with lib.types; attrsOf unspecified;
|
||||
default = {};
|
||||
};
|
||||
config.inputInjection = {
|
||||
flake-inputs = inputs;
|
||||
};
|
||||
};
|
||||
defaultModules = system: [
|
||||
inputInjection
|
||||
];
|
||||
mkSystem = system: extraModules:
|
||||
nixpkgs.lib.nixosSystem rec {
|
||||
modules = (defaultModules system) ++ extraModules;
|
||||
inherit system;
|
||||
specialArgs = {inherit system;};
|
||||
};
|
||||
mkHomeManager = confName: user: system: # unfortunately, home-manager configs are still system-specific
|
||||
# FIXME: this is thus still linux-x86_64 specific
|
||||
home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
modules = [
|
||||
{
|
||||
imports = [
|
||||
nur.hmModules.nur
|
||||
# TODO: $name can be utilised to conditionally load other config files
|
||||
./home/home.nix
|
||||
];
|
||||
# extends the home config
|
||||
home.username = user;
|
||||
home.homeDirectory = "/home/${user}";
|
||||
}
|
||||
];
|
||||
# Optionally use extraSpecialArgs
|
||||
# to pass through arguments to home.nix
|
||||
extraSpecialArgs = {
|
||||
inherit inputs system;
|
||||
};
|
||||
};
|
||||
treefmtConf = {pkgs, ...}:{
|
||||
projectRootFile = "flake.nix";
|
||||
programs.nixfmt-rfc-style.enable = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
overlays.default = import ./packages;
|
||||
nixosConfigurations = {
|
||||
thinknix = mkSystem systems.x86_64-linux [ ./hosts/thinknix inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440s lanzaboote.nixosModules.lanzaboote ];
|
||||
framenix = mkSystem systems.x86_64-linux [ ./hosts/framenix inputs.nixos-hardware.nixosModules.framework-13-7040-amd lanzaboote.nixosModules.lanzaboote ];
|
||||
};
|
||||
homeConfigurations.spiollinux = mkHomeManager "spiollinux" "spiollinux" systems.x86_64-linux;
|
||||
} // utils.lib.eachDefaultSystem(system:
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
nur,
|
||||
lanzaboote,
|
||||
utils,
|
||||
home-manager,
|
||||
treefmt-nix,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
nixpkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
overlays = nixpkgs.lib.attrValues self.overlays;
|
||||
# FIXME: allow different systems
|
||||
systems = utils.lib.system;
|
||||
# necessary to make the top-level inputs available to system configuration
|
||||
# inspired by https://jade.fyi/blog/flakes-arent-real/
|
||||
inputInjection =
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
options.inputInjection = lib.mkOption {
|
||||
type = with lib.types; attrsOf unspecified;
|
||||
default = { };
|
||||
};
|
||||
config.inputInjection = {
|
||||
flake-inputs = inputs;
|
||||
};
|
||||
};
|
||||
defaultModules = system: [ inputInjection ];
|
||||
mkSystem =
|
||||
system: extraModules:
|
||||
nixpkgs.lib.nixosSystem rec {
|
||||
modules = (defaultModules system) ++ extraModules;
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit system;
|
||||
};
|
||||
};
|
||||
mkHomeManager =
|
||||
confName: user: system: # unfortunately, home-manager configs are still system-specific
|
||||
# FIXME: this is thus still linux-x86_64 specific
|
||||
home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
modules = [
|
||||
{
|
||||
imports = [
|
||||
nur.hmModules.nur
|
||||
# TODO: $name can be utilised to conditionally load other config files
|
||||
./home/home.nix
|
||||
];
|
||||
# extends the home config
|
||||
home.username = user;
|
||||
home.homeDirectory = "/home/${user}";
|
||||
}
|
||||
];
|
||||
# Optionally use extraSpecialArgs
|
||||
# to pass through arguments to home.nix
|
||||
extraSpecialArgs = {
|
||||
inherit inputs system;
|
||||
};
|
||||
};
|
||||
treefmtConf =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
projectRootFile = "flake.nix";
|
||||
programs.nixfmt-rfc-style.enable = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
overlays.default = import ./packages;
|
||||
nixosConfigurations = {
|
||||
thinknix = mkSystem systems.x86_64-linux [
|
||||
./hosts/thinknix
|
||||
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440s
|
||||
lanzaboote.nixosModules.lanzaboote
|
||||
];
|
||||
framenix = mkSystem systems.x86_64-linux [
|
||||
./hosts/framenix
|
||||
inputs.nixos-hardware.nixosModules.framework-13-7040-amd
|
||||
lanzaboote.nixosModules.lanzaboote
|
||||
];
|
||||
};
|
||||
nixpkgs_unstable = import inputs.nixos-unstable {
|
||||
inherit system;
|
||||
overlays = nixpkgs.lib.attrValues self.overlays;
|
||||
};
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
pkgs_unstable = inputs.nixos-unstable.legacyPackages.${system};
|
||||
treefmtEval = treefmt-nix.lib.evalModule pkgs_unstable treefmtConf;
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = [];
|
||||
};
|
||||
formatter = treefmtEval.config.build.wrapper;
|
||||
checks.formatting = treefmtEval.config.build.check self;
|
||||
# expose nixpkgs with overlay; TODO: figure out role of config
|
||||
#legacyPackages = nixpkgs;
|
||||
});
|
||||
homeConfigurations.spiollinux = mkHomeManager "spiollinux" "spiollinux" systems.x86_64-linux;
|
||||
}
|
||||
// utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
nixpkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
overlays = nixpkgs.lib.attrValues self.overlays;
|
||||
};
|
||||
nixpkgs_unstable = import inputs.nixos-unstable {
|
||||
inherit system;
|
||||
overlays = nixpkgs.lib.attrValues self.overlays;
|
||||
};
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
pkgs_unstable = inputs.nixos-unstable.legacyPackages.${system};
|
||||
treefmtEval = treefmt-nix.lib.evalModule pkgs_unstable treefmtConf;
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell { buildInputs = [ ]; };
|
||||
formatter = treefmtEval.config.build.wrapper;
|
||||
checks.formatting = treefmtEval.config.build.check self;
|
||||
# expose nixpkgs with overlay; TODO: figure out role of config
|
||||
#legacyPackages = nixpkgs;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue