Skip to content

Instantly share code, notes, and snippets.

@marcusramberg
Created February 12, 2023 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusramberg/327b51d698bdac3631b4d49f25fd06d5 to your computer and use it in GitHub Desktop.
Save marcusramberg/327b51d698bdac3631b4d49f25fd06d5 to your computer and use it in GitHub Desktop.
{
description = "NixOS configuration";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
nixos-wsl.url = "github:nix-community/NixOS-WSL";
darwin.url = "github:lnl7/nix-darwin/master";
darwin.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs @ { self, nixpkgs, home-manager, neovim-nightly-overlay, darwin, nixos-wsl }:
let
inherit (darwin.lib) darwinSystem;
inherit (inputs.nixpkgs.lib) attrValues optionalAttrs singleton;
system = "x86_64-linux";
secrets = import ./secrets;
homeManagerConfig = {
nixpkgs = {
config = { allowUnfree = true; allowBroken = true; allowUnsupportedSystem = true; };
};
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.marcus = import ./home;
};
in
{
nixosConfigurations = {
mhub = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs; inherit secrets; };
modules = [
./hosts/mhub
./nixos
home-manager.nixosModules.home-manager
homeManagerConfig
];
};
butterbee = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs; inherit secrets; };
modules = [
./hosts/butterbee
./nixos
home-manager.nixosModules.home-manager
homeManagerConfig
];
};
mbox = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs; inherit secrets; };
modules = [
./hosts/mbox
./nixos
nixos-wsl.nixosModules.wsl
home-manager.nixosModules.home-manager
homeManagerConfig
];
};
};
darwinConfigurations.mbook = darwinSystem {
system = "aarch64-darwin";
modules = attrValues self.darwinModules ++ [
# Main `nix-darwin` config
./darwin
# `home-manager` module
home-manager.darwinModules.home-manager
homeManagerConfig
];
};
darwinModules = {
programs-nix-index =
# Additional configuration for `nix-index` to enable `command-not-found` functionality with Fish.
{ config, lib, pkgs, ... }:
{
config = lib.mkIf config.programs.nix-index.enable {
programs.fish.interactiveShellInit = ''
function __fish_command_not_found_handler --on-event="fish_command_not_found"
${if config.programs.fish.useBabelfish then ''
command_not_found_handle $argv
'' else ''
${pkgs.bashInteractive}/bin/bash -c \
"source ${config.programs.nix-index.package}/etc/profile.d/command-not-found.sh; command_not_found_handle $argv"
''}
end
'';
};
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment