Skip to content

Commit

Permalink
migrate nixpkgs-fmt to nixfmt
Browse files Browse the repository at this point in the history
Signed-off-by: iosmanthus <[email protected]>
  • Loading branch information
iosmanthus committed Sep 14, 2024
1 parent d53fe28 commit ce87422
Show file tree
Hide file tree
Showing 102 changed files with 1,266 additions and 1,264 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ switch:
@nixos-rebuild switch --use-remote-sudo |& nom

format:
@fd --glob "*.nix" --exec-batch "nixpkgs-fmt"
@fd --glob "*.nix" --exec-batch "nixfmt"
@fd --glob "*.py" --exec-batch "yapf" "-i"

update:
Expand Down
156 changes: 83 additions & 73 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,43 +46,47 @@
vaultwarden.url = "github:iosmanthus/nixpkgs/bump-vaultwarden-20240912141923";
};
outputs =
{ self
, nixpkgs
, master
, flake-utils
, home-manager
, sops-nix
, berberman
, base16
, code-insiders
, nixos-generators
, nur
, nixos-hardware
, ...
{
self,
nixpkgs,
master,
flake-utils,
home-manager,
sops-nix,
berberman,
base16,
code-insiders,
nixos-generators,
nur,
nixos-hardware,
...
}@inputs:
let
this = import ./packages;

mkWorkstationModules =
system: [
./nixos/workstation
./secrets/workstation
mkWorkstationModules = system: [
./nixos/workstation
./secrets/workstation

self.nixosModules.workstation
self.nixosModules.admin.iosmanthus
self.nixosModules.workstation
self.nixosModules.admin.iosmanthus

sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
base16.nixosModule
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
base16.nixosModule

({ config, ... }: {
(
{ config, ... }:
{
home-manager = {
users.${config.admin.name} = { ... }: {
imports = [
(./secrets + "/${config.admin.name}")
./nixos/workstation/home
];
};
users.${config.admin.name} =
{ ... }:
{
imports = [
(./secrets + "/${config.admin.name}")
./nixos/workstation/home
];
};
sharedModules = [
sops-nix.homeManagerModule
base16.nixosModule
Expand All @@ -95,50 +99,49 @@
useGlobalPkgs = true;
verbose = true;
};
})
{
nixpkgs.overlays =
[
self.overlays.unstable
self.overlays.jetbrains
self.overlays.default

berberman.overlays.default
code-insiders.overlays.default
nur.overlay
];
}
];
)
{
nixpkgs.overlays = [
self.overlays.unstable
self.overlays.jetbrains
self.overlays.default

berberman.overlays.default
code-insiders.overlays.default
nur.overlay
];
}
];
in
{
packages.x86_64-linux = this.packages
(import nixpkgs {
config = {
allowUnfree = true;
};
system = "x86_64-linux";
}) // {
nixos-gce-image = nixos-generators.nixosGenerate {
system = "x86_64-linux";
format = "gce";
specialArgs = {
inherit self;
packages.x86_64-linux =
this.packages (
import nixpkgs {
config = {
allowUnfree = true;
};
system = "x86_64-linux";
}
)
// {
nixos-gce-image = nixos-generators.nixosGenerate {
system = "x86_64-linux";
format = "gce";
specialArgs = {
inherit self;
};
modules = [ self.nixosModules.cloud.gce ];
};
modules = [
self.nixosModules.cloud.gce
];
};
};
overlays = {
default = this.overlay;
unstable = this.branchOverlay {
branch = master;
system = "x86_64-linux";
config = {
allowUnfree = true;
permittedInsecurePackages = [
"openssl-1.1.1w"
];
permittedInsecurePackages = [ "openssl-1.1.1w" ];
};
packages = [
"bat"
Expand Down Expand Up @@ -172,20 +175,26 @@
jetbrains = this.branchOverlay {
branch = inputs.jetbrains;
system = "x86_64-linux";
config = { allowUnfree = true; };
config = {
allowUnfree = true;
};
packages = [ "jetbrains" ];
};
vaultwarden = this.branchOverlay {
branch = inputs.vaultwarden;
system = "x86_64-linux";
config = { allowUnfree = true; };
config = {
allowUnfree = true;
};
packages = [ "vaultwarden" ];
};
};
nixosModules = import ./modules;
nixosConfigurations = {
iosmanthus-xps = nixpkgs.lib.nixosSystem rec {
specialArgs = { inherit self; };
specialArgs = {
inherit self;
};
system = "x86_64-linux";
modules = [
./nixos/iosmanthus-xps
Expand All @@ -195,9 +204,7 @@

iosmanthus-legion = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [
./nixos/iosmanthus-legion
] ++ (mkWorkstationModules system);
modules = [ ./nixos/iosmanthus-legion ] ++ (mkWorkstationModules system);
};

aws-lightsail-0 = nixpkgs.lib.nixosSystem {
Expand Down Expand Up @@ -346,13 +353,15 @@
];
};
};
} // flake-utils.lib.eachSystem
[ "x86_64-linux" ]
(system:
}
// flake-utils.lib.eachSystem [ "x86_64-linux" ] (
system:
let
pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
config = {
allowUnfree = true;
};
};
in
{
Expand All @@ -365,13 +374,14 @@
google-cloud-sdk
gotools
nix-output-monitor
nixpkgs-fmt
nixfmt-rfc-style
nodejs
sops
statix
terraform
yapf
];
};
});
}
);
}
10 changes: 3 additions & 7 deletions modules/admin/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{
iosmanthus =
{ pkgs
, config
, ...
}: {
imports = [
./options.nix
];
{ pkgs, config, ... }:
{
imports = [ ./options.nix ];

admin = rec {
name = "iosmanthus";
Expand Down
46 changes: 16 additions & 30 deletions modules/admin/options.nix
Original file line number Diff line number Diff line change
@@ -1,37 +1,23 @@
{ lib
, ...
}:
{ lib, ... }:
with lib;
let
adminOpts = { ... }: {
options = {
name = mkOption {
type = types.str;
};
email = mkOption {
type = types.str;
};
home = mkOption {
type = types.str;
};
shell = mkOption {
type = types.package;
};
hashedPasswordFile = mkOption {
type = types.path;
};
sshPubKey = mkOption {
type = types.str;
};
gpgPubKey = mkOption {
type = types.str;
default = "";
adminOpts =
{ ... }:
{
options = {
name = mkOption { type = types.str; };
email = mkOption { type = types.str; };
home = mkOption { type = types.str; };
shell = mkOption { type = types.package; };
hashedPasswordFile = mkOption { type = types.path; };
sshPubKey = mkOption { type = types.str; };
gpgPubKey = mkOption {
type = types.str;
default = "";
};
};
};
};
in
{
options.admin = mkOption {
type = types.submodule adminOpts;
};
options.admin = mkOption { type = types.submodule adminOpts; };
}
14 changes: 12 additions & 2 deletions modules/atuin/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
inherit (lib) mkOption types mdDoc mkIf;
inherit (lib)
mkOption
types
mdDoc
mkIf
;
cfg = config.services.self-hosted.atuin;
in
{
Expand Down
5 changes: 2 additions & 3 deletions modules/base16/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{ self
, ...
}: {
{ self, ... }:
{
# system: "base16"
# name: "Material Darker"
# author: "Nate Peterson"
Expand Down
26 changes: 10 additions & 16 deletions modules/chinadns/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{ config
, pkgs
, lib
, ...
{
config,
pkgs,
lib,
...
}:
with lib;
let
cfg = config.services.self-hosted.chinadns;
writeShScript = name: text:
writeShScript =
name: text:
let
dir = pkgs.writeScriptBin name ''
#! ${pkgs.runtimeShell} -e
Expand Down Expand Up @@ -41,15 +43,9 @@ in
type = types.str;
default = "127.0.0.1:10888";
};
geoipCN = mkOption {
type = types.path;
};
geositeCN = mkOption {
type = types.path;
};
geositeNotCN = mkOption {
type = types.path;
};
geoipCN = mkOption { type = types.path; };
geositeCN = mkOption { type = types.path; };
geositeNotCN = mkOption { type = types.path; };
statePath = mkOption {
type = types.path;
default = "/var/lib/chinadns/data";
Expand Down Expand Up @@ -110,5 +106,3 @@ in
};
};
}


Loading

0 comments on commit ce87422

Please sign in to comment.