Skip to content

Commit

Permalink
Implemented DuckDNS module. Renamed avalon host to atlas.
Browse files Browse the repository at this point in the history
  • Loading branch information
iivvaannxx committed Sep 9, 2023
1 parent 3742b8f commit cdfc98b
Show file tree
Hide file tree
Showing 18 changed files with 319 additions and 60 deletions.
38 changes: 38 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 40 additions & 31 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
{
description = "My personal NixOS system configuration.";

inputs = {

flake-parts.url = "github:hercules-ci/flake-parts";

# Only used to avoid dependency duplication (Multiple inputs use flake-utils).
flake-utils.url = "github:numtide/flake-utils";

# The package sets to use.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
unstablepkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

# HM to manage home directories.
home-manager = {

url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs";
};

# To generate easy ISOs.
nixos-generators = {

url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { flake-parts, nixpkgs, unstablepkgs, home-manager, ... } @ inputs: let

# Extend the default library with our own set of functions.
Expand All @@ -36,13 +9,17 @@
createHost = system: hostPath: users: (lib.custom.mkHost {

inherit hostPath system users inputs lib
nixpkgs unstablepkgs home-manager;
nixpkgs unstablepkgs home-manager;

# Add here the modules received in the flake inputs (except HM, which is handled automatically).
extraNixosModules = [

inputs.sops-nix.nixosModules.sops
];
});

in flake-parts.lib.mkFlake { inherit inputs; } {

imports = [ ];

# The systems tested at the moment.
systems = [ "x86_64-linux" ];
perSystem = { config, self', inputs', pkgs, upkgs, system, ... } @ args: let
Expand All @@ -59,7 +36,39 @@

flake = {

nixosConfigurations.avalon = createHost "x86_64-linux" ./hosts/avalon [ ./users/iivvaannxx ];
nixosConfigurations.avalon = createHost "x86_64-linux" ./hosts/atlas [ ./users/iivvaannxx ];
};
};

inputs = {

# Only used to avoid dependency duplication (Multiple inputs use flake-utils).
flake-utils.url = "github:numtide/flake-utils";
flake-parts.url = "github:hercules-ci/flake-parts";

# The package sets to use.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
unstablepkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

# HM to manage home directories.
home-manager = {

url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs";
};

# To generate easy ISOs.
nixos-generators = {

url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};

# To manage secrets.
sops-nix = {

url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
}
2 changes: 1 addition & 1 deletion helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repl () {
rebuild () {

mode=${1:-switch}
host=${2:-avalon}
host=${2:-atlas}

sudo nixos-rebuild $mode --flake .#$host
}
13 changes: 10 additions & 3 deletions hosts/avalon/default.nix → hosts/atlas/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,16 @@ in {
cached-nix-shell
];

programs._1password-gui.enable = true;
programs._1password-gui.package = upkgs._1password-gui;
programs._1password-gui.polkitPolicyOwners = [ "iivvaannxx" ];
modules.tools.onepassword = {

cli.enable = true;
gui = {

enable = true;
package = upkgs._1password-gui;
polkitPolicyOwners = [ "iivvaannxx" ];
};
};

programs.zsh.enable = true;
environment.shells = [ pkgs.zsh ];
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion hosts/avalon/hardware.nix → hosts/atlas/hardware.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ in {
# Auto-generated settings. Better to not touch them.
powerManagement.cpuFreqGovernor = mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = mkDefault config.hardware.enableRedistributableFirmware;
}

hardware.logitech.wireless.enable = true;
}
39 changes: 39 additions & 0 deletions hosts/atlas/networking.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{ config, lib, pkgs, ... } @ args: let

inherit (lib) mkDefault;

in {

modules.networking.duckdns = {

enable = false;
domains = [

{
name = "the name of the duckdns domain";
token = "fill this when secrets are ready.";
}
];
};

networking = {

wireless.enable = false;
hostName = "atlas";

defaultGateway = "192.168.25.1";
nameservers = [ "1.1.1.1" "1.0.0.1" ];

interfaces = {

eno2.ipv4.addresses = [

{
address = "192.168.25.50";
prefixLength = 24;
}
];
};

};
}
9 changes: 0 additions & 9 deletions hosts/avalon/networking.nix

This file was deleted.

2 changes: 0 additions & 2 deletions lib/conditionals.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,4 @@ in {

# Makes the given value unless the given predicate is true.
mkUnless = pred: val: (mkIf (! pred) val);


}
3 changes: 2 additions & 1 deletion lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ in {

mkSubmoduleOption
mkSubmoduleListOption
mkDynamicAttrsetOption
mkSubmoduleWithConfigOption

mkDynamicAttrsetOption
mkPackageListOption
;

Expand Down
5 changes: 2 additions & 3 deletions lib/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
in {

# Creates a host from the given arguments.
mkHost = { hostPath, system, users, inputs, lib, nixpkgs, unstablepkgs, home-manager }: let
mkHost = { hostPath, system, users, inputs, lib, nixpkgs, unstablepkgs, home-manager, extraNixosModules ? [ ] }: let

inherit (lib) nixosSystem;
inherit (lib.custom) fromJSON';
Expand Down Expand Up @@ -97,10 +97,9 @@ in {
inherit system lib;

specialArgs = nixosSpecialArgs;
modules = nixosModules ++ [
modules = nixosModules ++ extraNixosModules ++ [

hostPath

nixSystemRegistry
nixosUsers

Expand Down
10 changes: 10 additions & 0 deletions lib/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ in {
}
);

# Shorthand for creating submodule options in custom modules.
mkSubmoduleWithConfigOption = default: description: submodule: config: (

mkOption {

inherit default description;
type = types.submodule { inherit config; options = submodule; };
}
);

# Shorthand for creating submodule lists options in custom modules.
mkSubmoduleListOption = default: description: submodule: (

Expand Down
3 changes: 2 additions & 1 deletion modules/nixos/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[

./networking/duck-dns
./tools/onepassword
]
Loading

0 comments on commit cdfc98b

Please sign in to comment.