Skip to content

Commit

Permalink
wip: flaked nixos config
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
caarlos0 committed Nov 23, 2023
1 parent ba1d0d1 commit 0e6d739
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 63 deletions.
2 changes: 1 addition & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tasks:
- tmux source ~/.config/tmux/tmux.conf
nixos:
cmds:
- sudo nixos-rebuild switch -I nixos-config=./machines/{{ .HOSTNAME }}.nix
- sudo nixos-rebuild switch --flake .#
darwin:
status:
- "test $(uname -s) -ne Darwin"
Expand Down
54 changes: 27 additions & 27 deletions flake.lock

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

11 changes: 10 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@
, darwin
, home-manager
, nix-index-database
, nixpkgs
, ...
}@inputs:
let
overlays = [
inputs.neovim-nightly.overlay # TODO: https://github.com/nix-community/neovim-nightly-overlay/issues/332
inputs.neovim-nightly.overlay
(final: prev: {
nur = import nur {
nurpkgs = prev;
Expand All @@ -58,6 +59,14 @@
];
in
{
nixosConfigurations = {
darkstar = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./machines/darkstar.nix
];
};
};
darwinConfigurations."supernova" = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [ ./machines/supernova.nix ];
Expand Down
2 changes: 1 addition & 1 deletion machines/darkstar.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
imports =
[
./shared.nix
/etc/nixos/hardware-configuration.nix
./hardware/darkstar.nix
];

networking.hostName = "darkstar";
Expand Down
31 changes: 31 additions & 0 deletions machines/hardware/darkstar.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];

boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];

fileSystems."/" =
{ device = "/dev/disk/by-uuid/fde00b54-7779-4e86-b1d2-df0e4f93a59b";
fsType = "ext4";
};

swapDevices = [ ];

# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;

nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}
32 changes: 0 additions & 32 deletions machines/shared.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
{ config, pkgs, ... }:
let
unstableTarball =
fetchTarball
"https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz";
in

{
imports =
[
<home-manager/nixos>
./tailscale.nix
];

Expand Down Expand Up @@ -76,13 +69,7 @@ in
};

nixpkgs.config = {
# Allow unfree packages
allowUnfree = true;
packageOverrides = pkgs: {
unstable = import unstableTarball {
config = config.nixpkgs.config;
};
};
};

nix = {
Expand All @@ -98,9 +85,6 @@ in
};
};


# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
cachix
curl
Expand All @@ -112,18 +96,8 @@ in
wget
];

# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
programs.fish.enable = true;

# List services that you want to enable:

# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.cron.enable = true;
services.avahi = {
Expand All @@ -135,10 +109,4 @@ in
addresses = true;
};
};

# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
}
2 changes: 1 addition & 1 deletion machines/tailscale.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
services.tailscale = {
enable = true;
package = pkgs.unstable.tailscale;
package = pkgs.tailscale;
};

# create a oneshot job to authenticate to Tailscale
Expand Down
5 changes: 5 additions & 0 deletions modules/neovim/config/lua/lsp_keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ M.on_attach = function(bufnr)
vim.diagnostic.goto_next({ float = false })
vim.cmd("norm zz")
end, bufnr)

keymap("<leader>v", function()
vim.cmd("<cmd>vsplit | lua vim.lsp.buf.definition()<CR>")
vim.cmd("norm zz")
end, bufnr)
end

return M

0 comments on commit 0e6d739

Please sign in to comment.