How to share nix store among multiple aws instances?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I am using nixops and want to reduce disk space consumption by sharing nix store among instances.



Possible implementation:



  • share /nix/store store through elastic file system.

  • make cron job on random machine inside network that runs nix-collect-garbage -d. This will remove all packages that are not linked with first machine: actually stale packages and packages of other machines inside network. To restore them first machine triggers nixos-rebuild switch on other machines inside network.

Can this be done better/does this make sense?







share|improve this question


















  • 1




    Not sure if this works for NixOS, but I once shared the nix store via NFS: nixos.wiki/wiki/NFS#Nix_store_on_NFS You could probably put overlayfs on top of NFS to allow local modifications.
    – Mic92
    May 22 at 15:13











  • The nixos iso also shows how readonly and read-write layers can be overlayed: github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/…
    – Mic92
    May 22 at 15:17











  • Only having a single read-only /nix/store has it caveats as the nix store also store configuration files. Sharing the same elastic filesystem could work so, if your network storage implements posix file locking. nix-collect-garbage usually relies on seeing other processes using files - in a distributed settings it might delete files in use.
    – Mic92
    May 22 at 15:21















up vote
0
down vote

favorite












I am using nixops and want to reduce disk space consumption by sharing nix store among instances.



Possible implementation:



  • share /nix/store store through elastic file system.

  • make cron job on random machine inside network that runs nix-collect-garbage -d. This will remove all packages that are not linked with first machine: actually stale packages and packages of other machines inside network. To restore them first machine triggers nixos-rebuild switch on other machines inside network.

Can this be done better/does this make sense?







share|improve this question


















  • 1




    Not sure if this works for NixOS, but I once shared the nix store via NFS: nixos.wiki/wiki/NFS#Nix_store_on_NFS You could probably put overlayfs on top of NFS to allow local modifications.
    – Mic92
    May 22 at 15:13











  • The nixos iso also shows how readonly and read-write layers can be overlayed: github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/…
    – Mic92
    May 22 at 15:17











  • Only having a single read-only /nix/store has it caveats as the nix store also store configuration files. Sharing the same elastic filesystem could work so, if your network storage implements posix file locking. nix-collect-garbage usually relies on seeing other processes using files - in a distributed settings it might delete files in use.
    – Mic92
    May 22 at 15:21













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am using nixops and want to reduce disk space consumption by sharing nix store among instances.



Possible implementation:



  • share /nix/store store through elastic file system.

  • make cron job on random machine inside network that runs nix-collect-garbage -d. This will remove all packages that are not linked with first machine: actually stale packages and packages of other machines inside network. To restore them first machine triggers nixos-rebuild switch on other machines inside network.

Can this be done better/does this make sense?







share|improve this question














I am using nixops and want to reduce disk space consumption by sharing nix store among instances.



Possible implementation:



  • share /nix/store store through elastic file system.

  • make cron job on random machine inside network that runs nix-collect-garbage -d. This will remove all packages that are not linked with first machine: actually stale packages and packages of other machines inside network. To restore them first machine triggers nixos-rebuild switch on other machines inside network.

Can this be done better/does this make sense?









share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 20:45









Jeff Schaller

31.8k848109




31.8k848109










asked Jan 3 at 20:23









srghma

1296




1296







  • 1




    Not sure if this works for NixOS, but I once shared the nix store via NFS: nixos.wiki/wiki/NFS#Nix_store_on_NFS You could probably put overlayfs on top of NFS to allow local modifications.
    – Mic92
    May 22 at 15:13











  • The nixos iso also shows how readonly and read-write layers can be overlayed: github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/…
    – Mic92
    May 22 at 15:17











  • Only having a single read-only /nix/store has it caveats as the nix store also store configuration files. Sharing the same elastic filesystem could work so, if your network storage implements posix file locking. nix-collect-garbage usually relies on seeing other processes using files - in a distributed settings it might delete files in use.
    – Mic92
    May 22 at 15:21













  • 1




    Not sure if this works for NixOS, but I once shared the nix store via NFS: nixos.wiki/wiki/NFS#Nix_store_on_NFS You could probably put overlayfs on top of NFS to allow local modifications.
    – Mic92
    May 22 at 15:13











  • The nixos iso also shows how readonly and read-write layers can be overlayed: github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/…
    – Mic92
    May 22 at 15:17











  • Only having a single read-only /nix/store has it caveats as the nix store also store configuration files. Sharing the same elastic filesystem could work so, if your network storage implements posix file locking. nix-collect-garbage usually relies on seeing other processes using files - in a distributed settings it might delete files in use.
    – Mic92
    May 22 at 15:21








1




1




Not sure if this works for NixOS, but I once shared the nix store via NFS: nixos.wiki/wiki/NFS#Nix_store_on_NFS You could probably put overlayfs on top of NFS to allow local modifications.
– Mic92
May 22 at 15:13





Not sure if this works for NixOS, but I once shared the nix store via NFS: nixos.wiki/wiki/NFS#Nix_store_on_NFS You could probably put overlayfs on top of NFS to allow local modifications.
– Mic92
May 22 at 15:13













The nixos iso also shows how readonly and read-write layers can be overlayed: github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/…
– Mic92
May 22 at 15:17





The nixos iso also shows how readonly and read-write layers can be overlayed: github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/…
– Mic92
May 22 at 15:17













Only having a single read-only /nix/store has it caveats as the nix store also store configuration files. Sharing the same elastic filesystem could work so, if your network storage implements posix file locking. nix-collect-garbage usually relies on seeing other processes using files - in a distributed settings it might delete files in use.
– Mic92
May 22 at 15:21





Only having a single read-only /nix/store has it caveats as the nix store also store configuration files. Sharing the same elastic filesystem could work so, if your network storage implements posix file locking. nix-collect-garbage usually relies on seeing other processes using files - in a distributed settings it might delete files in use.
– Mic92
May 22 at 15:21
















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f414625%2fhow-to-share-nix-store-among-multiple-aws-instances%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f414625%2fhow-to-share-nix-store-among-multiple-aws-instances%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay