Skip to content

Commit

Permalink
nixos/nix: init, based on nixos/meta and nixos/dev/cross-compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Sep 22, 2023
1 parent daeacfa commit 6b7a191
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 38 deletions.
1 change: 1 addition & 0 deletions hosts/miku-nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ in
desktop.audio.lowLatency.enable = true;
dev.enable = true;
games.enable = true;
nix.cross-compiling.enable = true;
server = {
plex.enable = true;
rtorrent.enable = true;
Expand Down
1 change: 1 addition & 0 deletions hosts/sankyuu-nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ in

nixos = {
dev.enable = true;
nix.cross-compiling.enable = true;
desktop = {
audio.lowLatency = {
enable = true;
Expand Down
1 change: 0 additions & 1 deletion nixos/dev/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ let
in
{
imports = [
./cross-compiling.nix
./virtualisation.nix
];

Expand Down
30 changes: 0 additions & 30 deletions nixos/meta.nix

This file was deleted.

4 changes: 2 additions & 2 deletions nixos/minimal.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

{
imports = [
./meta.nix
./system
../modules
./nix
./system
];
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{ config, lib, ... }:

let
cfg = config.nixos.dev.cross-compiling;
cfg = config.nixos.nix.cross-compiling;
in
{
options.nixos.dev.cross-compiling = {
enable = lib.mkEnableOption "cross-compiling config for nixpkgs" // {
default = config.nixos.dev.enable;
};
options.nixos.nix.cross-compiling = {
enable = lib.mkEnableOption "cross-compiling config for nixpkgs";
emulatedSystems = lib.mkOption {
description = "List of systems to emulate via QEMU";
type = lib.types.listOf lib.types.str;
default = [ "aarch64-linux" ];
};
};

config = lib.mkIf cfg.enable {
# Allow compilation of packages ARM/ARM64 architectures via QEMU
# e.g. nix-build -A <pkg> --argstr system aarch64-linux
Expand Down
35 changes: 35 additions & 0 deletions nixos/nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{ config, lib, pkgs, flake, ... }:

{
imports = [
../../cachix.nix
../../overlays
./cross-compiling.nix
];

options.nixos.nix.enable = lib.mkDefaultOption "nix/nixpkgs config";

config = lib.mkIf config.nixos.nix.enable {
# Add some Nix related packages
environment.systemPackages = with pkgs; [
nixos-cleanup
nom-rebuild
];

nix = import ../../shared/nix.nix { inherit pkgs flake; };

# Enable unfree packages
nixpkgs.config.allowUnfree = true;

# Change build dir to /var/tmp
systemd.services.nix-daemon = {
environment.TMPDIR = lib.mkDefault "/var/tmp";
};

# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = lib.mkDefault "23.11"; # Did you read the comment?
};
}

0 comments on commit 6b7a191

Please sign in to comment.